-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include <QToolBar> | ||
#include <QIcon> | ||
#include <QAction> | ||
#include <QMenu> | ||
#include <QMenuBar> | ||
#include <QStatusBar> | ||
#include <QTextEdit> | ||
#include <QApplication> | ||
|
||
#include "appwindow.h" | ||
|
||
AppWindow::AppWindow() | ||
{ | ||
auto* newAct = new QAction(tr("&New"), this); | ||
auto* openAct = new QAction(tr("&Open"), this); | ||
auto* quitAct = new QAction(tr("&Quit"), this); | ||
quitAct->setShortcuts(QKeySequence::Quit); | ||
quitAct->setStatusTip(tr("Exit the application")); | ||
|
||
connect(quitAct, &QAction::triggered, qApp, &QApplication::quit); | ||
|
||
auto* menu = menuBar()->addMenu(tr("&File")); | ||
menu->addAction(newAct); | ||
menu->addAction(openAct); | ||
menu->addAction(quitAct); | ||
|
||
auto* toolbar = addToolBar(tr("Main toolbar")); | ||
toolbar->addAction(newAct); | ||
toolbar->addAction(openAct); | ||
toolbar->addSeparator(); | ||
toolbar->addAction(quitAct); | ||
|
||
auto* edit = new QTextEdit(this); | ||
edit->setText("Hello, world!"); | ||
edit->append(QString("Qt version: ") + qVersion()); | ||
|
||
setCentralWidget(edit); | ||
|
||
statusBar()->showMessage(tr("Ready")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include <QMainWindow> | ||
|
||
class AppWindow : public QMainWindow | ||
{ | ||
public: | ||
AppWindow(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
tasks: | ||
main: | ||
features : cxxprogram qt5 | ||
source : appwindow.cpp main.cpp | ||
use : QtWidgets | ||
|
||
GCC_BASE_FLAGS: -std=c++11 -fPIC | ||
|
||
buildtypes: | ||
debug: | ||
cxxflags: $GCC_BASE_FLAGS -O0 -g | ||
toolchain: g++ # force use of gcc | ||
|
||
release: | ||
cxxflags: $GCC_BASE_FLAGS -O2 | ||
toolchain: g++ # force use of gcc | ||
|
||
default: debug | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
#include <QApplication> | ||
|
||
#include "appwindow.h" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication app(argc, argv); | ||
|
||
AppWindow window; | ||
|
||
window.resize(500, 300); | ||
window.setWindowTitle("Simple example"); | ||
window.show(); | ||
|
||
return app.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters