mirror of
https://git.code.sf.net/p/newrpl/sources
synced 2024-11-16 19:51:25 +01:00
Reworked menu in QML
This commit is contained in:
parent
09781236eb
commit
b473146cb3
6 changed files with 150 additions and 6 deletions
23
main.cpp
23
main.cpp
|
@ -8,12 +8,35 @@
|
|||
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QWindow>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml")));
|
||||
if (engine.rootObjects().isEmpty())
|
||||
return -1;
|
||||
|
||||
QWindow *qmlWindow = qobject_cast<QWindow*>(engine.rootObjects().at(0));
|
||||
QWidget *container = QWidget::createWindowContainer(qmlWindow);
|
||||
container->setMinimumSize (qmlWindow->size ().width (), qmlWindow->size ().height ()+30);
|
||||
|
||||
MainWindow w;
|
||||
|
||||
w.setMenuWidget (container);
|
||||
|
||||
|
||||
w.show();
|
||||
|
||||
|
||||
engine.rootContext()->setContextProperty("mymainWindow", &w);
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
|
|
@ -1140,7 +1140,7 @@ if(obj == ui->KeybImage)
|
|||
|
||||
if(ptr->keynum==64) {
|
||||
// PRESSED THE SIMULATED MAIN MENU KEY
|
||||
menuBar()->activateWindow();
|
||||
//menuBar()->activateWindow();
|
||||
}
|
||||
else {
|
||||
//TODO: HIGHLIGHT IT FOR VISUAL EFFECT
|
||||
|
|
|
@ -41,7 +41,7 @@ protected:
|
|||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private slots:
|
||||
public slots:
|
||||
void on_EmuScreen_destroyed();
|
||||
void on_actionExit_triggered();
|
||||
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
QT += core gui quick widgets quickcontrols2
|
||||
|
||||
TARGET = newrpl-ui
|
||||
TEMPLATE = app
|
||||
|
@ -295,7 +293,8 @@ FORMS += mainwindow.ui \
|
|||
usbselector.ui
|
||||
|
||||
RESOURCES += \
|
||||
annunciators.qrc
|
||||
annunciators.qrc \
|
||||
qml.qrc
|
||||
|
||||
|
||||
|
||||
|
|
5
qml.qrc
Normal file
5
qml.qrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qml/main.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
117
qml/main.qml
Normal file
117
qml/main.qml
Normal file
|
@ -0,0 +1,117 @@
|
|||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
ApplicationWindow {
|
||||
menuBar: MenuBar {
|
||||
|
||||
Menu {
|
||||
title: "File"
|
||||
Action {
|
||||
text: "Power On"
|
||||
onTriggered: mymainWindow.on_actionPower_ON_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "New"
|
||||
onTriggered: mymainWindow.on_actionNew_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Open"
|
||||
onTriggered: mymainWindow.on_actionOpen_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Save"
|
||||
onTriggered: mymainWindow.on_actionSave_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Save As"
|
||||
onTriggered: mymainWindow.on_actionSaveAs_triggered();
|
||||
}
|
||||
MenuSeparator {
|
||||
|
||||
}
|
||||
Action {
|
||||
text: "Exit"
|
||||
onTriggered: mymainWindow.on_actionExit_triggered();
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
title: "Stack"
|
||||
Action {
|
||||
text: "Copy Level 1"
|
||||
onTriggered: mymainWindow.on_actionCopy_Level_1_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Cut Level 1"
|
||||
onTriggered: mymainWindow.on_actionCut_Level_1_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Paste to Level 1"
|
||||
onTriggered: mymainWindow.on_actionPaste_to_Level_1_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Save Level 1 As..."
|
||||
onTriggered: mymainWindow.on_actionSave_Level_1_As_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Open file to Level 1"
|
||||
onTriggered: mymainWindow.on_actionOpen_file_to_Level_1_triggered();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "Hardware"
|
||||
Action {
|
||||
text: "Connect to calc"
|
||||
onTriggered: mymainWindow.on_actionConnect_to_calc_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "USB Remote ARCHIVE to File"
|
||||
onTriggered: mymainWindow.on_actionUSB_Remote_ARCHIVE_to_file_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Remote USBRESTORE from file"
|
||||
onTriggered: mymainWindow.on_actionRemote_USBRESTORE_from_file_triggered();
|
||||
}
|
||||
MenuSeparator {
|
||||
|
||||
}
|
||||
|
||||
Action {
|
||||
text: "Insert SD Card image"
|
||||
onTriggered: mymainWindow.on_actionInsert_SD_Card_Image_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Eject SD Card image"
|
||||
onTriggered: mymainWindow.on_actionEject_SD_Card_Image_triggered();
|
||||
}
|
||||
|
||||
MenuSeparator {
|
||||
|
||||
}
|
||||
|
||||
Action {
|
||||
text: "Simulate alarm"
|
||||
onTriggered: mymainWindow.on_actionInsert_SD_Card_Image_triggered();
|
||||
}
|
||||
Action {
|
||||
text: "Take Screenshot"
|
||||
onTriggered: mymainWindow.on_actionTake_Screenshot_triggered();
|
||||
}
|
||||
MenuSeparator {
|
||||
|
||||
}
|
||||
|
||||
Action {
|
||||
text: "Show LCD grid"
|
||||
checkable: true
|
||||
checked: false
|
||||
onCheckedChanged: mymainWindow.on_actionShow_LCD_grid_toggled(checked);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue