Qt5 Gui
This commit is contained in:
parent
d2274494f2
commit
3c9d11938e
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "cmake/cmlib"]
|
||||
path = cmake/cmlib
|
||||
url = ../../root/cmlib
|
||||
url = ../../f1x1t/cmlib
|
||||
|
@ -11,6 +11,7 @@ if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/cmlib)
|
||||
else()
|
||||
message(FATAL_ERROR "CMake library directory not exists")
|
||||
endif()
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/find)
|
||||
|
||||
include(CMLibCommon)
|
||||
|
||||
|
@ -1,30 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="ru_RU">
|
||||
<context>
|
||||
<name>MyMainWindow</name>
|
||||
<message>
|
||||
<location filename="../src/cmex/my_main_window.ui" line="14"/>
|
||||
<source>Main Window</source>
|
||||
<translation>Главное окно</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../src/cmex/main.cpp" line="18"/>
|
||||
<location filename="../src/cmex/main.cpp" line="20"/>
|
||||
<source>Compiler version: </source>
|
||||
<translation>Версия компилятора: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/cmex/main.cpp" line="19"/>
|
||||
<location filename="../src/cmex/main.cpp" line="21"/>
|
||||
<source>Project version: </source>
|
||||
<translation>Версия проекта: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/cmex/main.cpp" line="20"/>
|
||||
<location filename="../src/cmex/main.cpp" line="22"/>
|
||||
<source>Build type: </source>
|
||||
<translation>Тип сборки: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/cmex/main.cpp" line="21"/>
|
||||
<location filename="../src/cmex/main.cpp" line="23"/>
|
||||
<source>libcmex function call: </source>
|
||||
<translation>Вызов функции из libcmex: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/cmex/main.cpp" line="22"/>
|
||||
<location filename="../src/cmex/main.cpp" line="24"/>
|
||||
<source>libcmext function call: </source>
|
||||
<translation>Вызов функции из libcmext: </translation>
|
||||
</message>
|
||||
|
@ -4,16 +4,25 @@ set(current_target cmex_app)
|
||||
# Список файлов исходных текстов
|
||||
set(current_target_sources
|
||||
main.cpp
|
||||
my_main_window.cpp
|
||||
)
|
||||
|
||||
set(current_target_uis
|
||||
my_main_window.ui
|
||||
)
|
||||
|
||||
# Цель для создания исполняемого файла
|
||||
add_executable(${current_target} ${current_target_sources})
|
||||
add_executable(${current_target} ${current_target_sources} ${current_target_uis})
|
||||
common_target_properties(${current_target})
|
||||
|
||||
# Qt5
|
||||
qt_translation(TARGET ${current_target} TS_DIR ${CMAKE_SOURCE_DIR}/l10n LANGUAGES ru_RU)
|
||||
target_include_directories(${current_target} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS})
|
||||
target_include_directories(${current_target} SYSTEM PUBLIC ${Qt5Gui_INCLUDE_DIRS})
|
||||
target_include_directories(${current_target} SYSTEM PUBLIC ${Qt5Widgets_INCLUDE_DIRS})
|
||||
target_link_libraries(${current_target} Qt5::Core)
|
||||
target_link_libraries(${current_target} Qt5::Gui)
|
||||
target_link_libraries(${current_target} Qt5::Widgets)
|
||||
|
||||
# Зависимость от библиотеки из текущего проекта
|
||||
add_dependencies(${current_target} cmex)
|
||||
|
@ -2,13 +2,15 @@
|
||||
#include "config.hpp"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtWidgets>
|
||||
#include <iostream>
|
||||
#include <cmext/cmext.hpp>
|
||||
|
||||
#include "cmex.hpp"
|
||||
#include "my_main_window.hpp"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
QCoreApplication app(argc, argv);
|
||||
QApplication app(argc, argv);
|
||||
QTranslator translator;
|
||||
|
||||
if (translator.load(QLocale(), "cmex_app", QLatin1String("_"), QLatin1String(":/qm")))
|
||||
@ -20,6 +22,9 @@ int main(int argc, char **argv) {
|
||||
std::cout << QObject::tr("Build type: ").toStdString() << BUILD_TYPE << std::endl; // Значение из config.hpp
|
||||
std::cout << QObject::tr("libcmex function call: ").toStdString() << cmex_init(4) << std::endl; // Функция из внутренней библиотеки
|
||||
std::cout << QObject::tr("libcmext function call: ").toStdString() << cmext_init(9) << std::endl; // Функция из внешней библиотеки
|
||||
return 0;
|
||||
|
||||
MyMainWindow* mmw = new MyMainWindow();
|
||||
mmw->show();
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
10
src/cmex/my_main_window.cpp
Normal file
10
src/cmex/my_main_window.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "my_main_window.hpp"
|
||||
|
||||
MyMainWindow::MyMainWindow(QWidget* parent) {
|
||||
|
||||
}
|
||||
|
||||
MyMainWindow::~MyMainWindow() {
|
||||
|
||||
}
|
||||
|
15
src/cmex/my_main_window.hpp
Normal file
15
src/cmex/my_main_window.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef CMEX_MY_MAIN_WINDOW_HPP_
|
||||
#define CMEX_MY_MAIN_WINDOW_HPP_
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_my_main_window.h"
|
||||
|
||||
class MyMainWindow : public QWidget, private Ui::MyMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MyMainWindow(QWidget* parent = 0);
|
||||
virtual ~MyMainWindow();
|
||||
};
|
||||
|
||||
#endif /* CMEX_MY_MAIN_WINDOW_HPP_ */
|
||||
|
20
src/cmex/my_main_window.ui
Normal file
20
src/cmex/my_main_window.ui
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MyMainWindow</class>
|
||||
<widget class="QMainWindow" name="MyMainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>678</width>
|
||||
<height>415</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Main Window</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user