qt5

CMake and Qt5 AUTOMOC error

折月煮酒 提交于 2021-02-18 15:51:41
问题 I have a project which uses Qt5 and I have a CMakeLists.txt file that I use for creating the Visual Studio Solution. This is an excerpt of my CMakeLists.txt cmake_policy(SET CMP0020 NEW) set(CMAKE_AUTOMOC ON) find_package(Qt5 REQUIRED COMPONENTS core widgets) set(COMMON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src) include_directories( ${Boost_INCLUDE_DIRS} ${COMMON_INCLUDE_DIR} ) file(GLOB_RECURSE COMMON_SOURCE "*.hpp" "*.cpp") add_library(${PROJECT_NAME} ${COMMON_SOURCE}) qt5_use_modules(${PROJECT

How to use mouseMoveEvent on paintEvent on Qt 5?

感情迁移 提交于 2021-02-13 17:44:19
问题 I'm new on Qt and c++, so I'm having some difficulties. I'm trying to create a widget that can get the mouseMoveEvent position and draw an ellipse on my pixmap on mouse position. Below you can see the code: #include "myimage.h" #include <QPainter> #include <QPen> #include <QColor> #include <QMouseEvent> #include <QDebug> Myimage::Myimage(QWidget *parent) : QWidget(parent) { setMouseTracking(true); // E.g. set in your constructor of your widget. } // Implement in your widget void Myimage:

How to use mouseMoveEvent on paintEvent on Qt 5?

℡╲_俬逩灬. 提交于 2021-02-13 17:39:40
问题 I'm new on Qt and c++, so I'm having some difficulties. I'm trying to create a widget that can get the mouseMoveEvent position and draw an ellipse on my pixmap on mouse position. Below you can see the code: #include "myimage.h" #include <QPainter> #include <QPen> #include <QColor> #include <QMouseEvent> #include <QDebug> Myimage::Myimage(QWidget *parent) : QWidget(parent) { setMouseTracking(true); // E.g. set in your constructor of your widget. } // Implement in your widget void Myimage:

How to use mouseMoveEvent on paintEvent on Qt 5?

时光总嘲笑我的痴心妄想 提交于 2021-02-13 17:38:08
问题 I'm new on Qt and c++, so I'm having some difficulties. I'm trying to create a widget that can get the mouseMoveEvent position and draw an ellipse on my pixmap on mouse position. Below you can see the code: #include "myimage.h" #include <QPainter> #include <QPen> #include <QColor> #include <QMouseEvent> #include <QDebug> Myimage::Myimage(QWidget *parent) : QWidget(parent) { setMouseTracking(true); // E.g. set in your constructor of your widget. } // Implement in your widget void Myimage:

C++ static members, multiple Objects

我们两清 提交于 2021-02-11 17:22:06
问题 I've got some trouble with static members and methods in C++. This is the Class header: class Decoration { public: //Static Methods static void reloadList(); //Static Members static std::unordered_map<int, Decoration> decorationMapID; }; And in .cpp: void Decoration::reloadList() { sqlTable result = db->exec("SELECT id, name, description FROM decorations"); for(sqlRow r: result) { Decoration::decorationMapID.insert(std::pair<int,Decoration>(atoi(r[0].c_str()), Decoration(r[1], r[2], atoi(r[0]

C++ static members, multiple Objects

喜夏-厌秋 提交于 2021-02-11 17:21:32
问题 I've got some trouble with static members and methods in C++. This is the Class header: class Decoration { public: //Static Methods static void reloadList(); //Static Members static std::unordered_map<int, Decoration> decorationMapID; }; And in .cpp: void Decoration::reloadList() { sqlTable result = db->exec("SELECT id, name, description FROM decorations"); for(sqlRow r: result) { Decoration::decorationMapID.insert(std::pair<int,Decoration>(atoi(r[0].c_str()), Decoration(r[1], r[2], atoi(r[0]

How to open a dialog after QComboBox choice

让人想犯罪 __ 提交于 2021-02-11 14:50:40
问题 I have a QComboBox with several choices on a QToolBar . Every choice of the QComboBox will open a specific dialog window. The problem I have is that after I choose the preferred index on the combobox no dialogs opens up. For simplicity of the example I am linking the same dialog to all choices: dredgewindow.h This is the header file namespace Ui { class DredgeWindow; } class DredgeWindow : public QMainWindow { Q_OBJECT public: explicit DredgeWindow(QWidget *parent = nullptr); ~DredgeWindow();

Qt Logging tool multithreading, calling signal and slot with variable number of arguments form another thread, mixing C and C++

十年热恋 提交于 2021-02-11 08:08:09
问题 This is my Logging class: #include "log.h" #include "ui_log.h" #include <QDebug> #include <QMutex> bool Log::logOpen = false; Log::Log(QWidget *parent) : QDialog(parent), ui(new Ui::Log) { ui->setupUi(this); text = new QString; this->bar = this->ui->logText->verticalScrollBar(); connect(this, SIGNAL(call_write(char*)), this, SLOT(write(char*))); } Log::~Log() { delete ui; } void Log::on_buttonClose_clicked() { Log::logOpen = false; close(); } void Log::on_buttonClear_clicked() { this->text-

Qt Logging tool multithreading, calling signal and slot with variable number of arguments form another thread, mixing C and C++

此生再无相见时 提交于 2021-02-11 08:07:59
问题 This is my Logging class: #include "log.h" #include "ui_log.h" #include <QDebug> #include <QMutex> bool Log::logOpen = false; Log::Log(QWidget *parent) : QDialog(parent), ui(new Ui::Log) { ui->setupUi(this); text = new QString; this->bar = this->ui->logText->verticalScrollBar(); connect(this, SIGNAL(call_write(char*)), this, SLOT(write(char*))); } Log::~Log() { delete ui; } void Log::on_buttonClose_clicked() { Log::logOpen = false; close(); } void Log::on_buttonClear_clicked() { this->text-

Deploy a Qt project on linux

柔情痞子 提交于 2021-02-11 06:17:42
问题 This may be a noob question, but I have been stuck trying to work out how to statically build my qt project on linux. I tried doing what it said on http://doc.qt.io/qt-5/linux-deployment.html , but I do not understand the 1st step. When I cd to the location of my qt project and run cd /path/to/Qt ./configure -static -prefix /path/to/Qt < otherparameters > make it says no such file or directory. Am I misunderstanding what paths I need to use? I want to make my qt project a stand alone