Category : qt

I have a car outline (png pixmap) and I need to place points on it. How can I put points on this outline? Is there any way in QT to find out what color a pixel is? Or is there some more elegant way? Source: Windows Que..

Read more

I am trying to connect to a PostgreSQL database in Qt: QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL"); db.setHostName("localhost"); db.setDatabaseName("postgres"); db.setUserName("postgres"); db.setPassword("pass"); db.setPort(5432); db.open() However, I get this error: QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QODBC I am running macOS Big Sur on M1 MacBook Pro. postgres is installed via Homebrew. Is there something I ..

Read more

I have a question about structures in c++. How should I declare struct color_rgba in this class? Just I get error: no matching function for call to ‘color_rgba::color_rgba()’ when I’m trying to do smth with this struct Child_rectangle_dialog.cpp #include "MainWindow.h" #include "color.h" class Child_rectangle_dialog : public QDialog { private: QLineEdit *cords_1, *cords_2; Image* our_im; QCheckBox* ..

Read more

I have a question about structures in c++. How should I declare struct color_rgba in this class? Just I get error: no matching function for call to ‘color_rgba::color_rgba()’ when I’m trying to do smth with this struct Child_rectangle_dialog.cpp #include "MainWindow.h" #include "color.h" class Child_rectangle_dialog : public QDialog { private: QLineEdit *cords_1, *cords_2; Image* our_im; QCheckBox* ..

Read more

my operation system is Windows7 SP1, Qt version is 5.12.0. I built an exe file by VS2017, when I double-click the exe to run, it will crash if its path contains any non-English characters(e.g. Chinese, Korean, Japanese, etc.) The code that triggered the crash is this line— QWebEngineSettings *settings = QWebEngineSettings::defaultSettings(); This is the disassembly ..

Read more

My goal is to allow user draw a polygon via clicking and moving the mouse without having to hold the mouse key. If the last point is within startPoint the drawing is finished. Additionally, I’m storing edges. I’ve made a MyDrawWindow class that inherits the QGraphicsView class. I implemented overrided mouse events there. From looking ..

Read more

I would like to add QTextEdit widgets in a layout and alternate the alignment QVBoxLayout *lt = new QVBoxLayout; for(int i=0;i<5;i++) { text1 = new QTextEdit; text1->setText("Hello world !" + QString::number(i)); text1->setMaximumSize(100,30); lt->addWidget(text1); lt->setAlignment(Qt::AlignLeft); if(i%2) { lt->setAlignment(Qt::AlignRight); } else { lt->setAlignment(Qt::AlignLeft); } } setLayout(lt); However, the QTextEdits, are all align on the left. Is there ..

Read more