Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.4k Posts
  • How to understand connection is lost on qt gamepad?

    Unsolved
    4
    0 Votes
    4 Posts
    262 Views
    Christian EhrlicherC
    If the signal is not emitted then it's maybe a bug - create a minimal, reproducible example and create a bug report if you're sure it's not a failure on your side. But looks like https://bugreports.qt.io/browse/QTBUG-85830 so no need to create a new bug report then.
  • Qtableview sorting issue

    Unsolved
    11
    0 Votes
    11 Posts
    1k Views
    JonBJ
    @eswaramrth03 As @VRonin has said. Please read the link @nagesh gave you and follow that QStandardItem::setData() pattern to correctly store numbers.
  • Qt Mqtt compilation failed

    Unsolved
    1
    0 Votes
    1 Posts
    151 Views
    No one has replied
  • GIT_VERSION variable in .pro

    Solved
    16
    0 Votes
    16 Posts
    2k Views
    AndrewBindrawA
    Hi. Please, check my repo. Set Qt App version from git. https://github.com/mrbindraw/TestVersion
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Exception Triggered

    Unsolved
    8
    0 Votes
    8 Posts
    752 Views
    SPlattenS
    Ok, this behaviour only happens when running in debug mode in Qt Creator, when running outside of Qt Creator it does not do this, again, this seems specific to the SDK. This doesn't happen in newer versions of the SDK.
  • Pulling git revision during build (with QT Creator)

    Unsolved
    11
    0 Votes
    11 Posts
    4k Views
    AndrewBindrawA
    Hi. Please, check my repo. Set Qt App version from git. https://github.com/mrbindraw/TestVersion
  • SQLite specify filename of database file?

    Solved
    2
    0 Votes
    2 Posts
    264 Views
    Christian EhrlicherC
    You can set the database name with QSqlDatabase::setDatabaseName()
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • Pixelated gif when used with QMovie

    Unsolved
    1
    0 Votes
    1 Posts
    218 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • Mysterious QMutex destroying locked mutex

    Unsolved qthread qmutex crash windows7
    14
    0 Votes
    14 Posts
    5k Views
    kshegunovK
    Humor me, will you? constexpr int poolSize = 16; QVector<QThread *> threadPool(poolSize); QCoreApplication * app = QCoreApplication::instance(); for (size_t i = 0; i < poolSize; i++) { QThread * thread = new QThread(app); thread->start(); QObject::connect(thread, &QThread::finished, thread, &QThread::deleteLater); } QObject::connect(app, &QCoreApplication::aboutToQuit, [threadPool] () -> void { for (QThread * thread : threadPool) { thread->quit(); thread->wait(); } }); int index = 0; for (const QString &video : videoFiles) { ThumbnailExtractor *extractor = new ThumbnailExtractor(counter, folderPath + '/' + video); extractor->moveToThread(threadPool[index++ % poolSize]); QObject::connect(extractor, &ThumbnailExtractor::finished, extractor, &QObject::deleteLater); QMetaObject::invokeMethod(extractor, &ThumbnailExtractor::generateThumbnail, Qt::QueuedConnection); } A note here: QMediaPlayer and related classes don't seem to be reentrant so you can't use them from different threads. Stick to the main one.
  • .ui file changes not applied to executable after compiling

    Unsolved
    1
    1 Votes
    1 Posts
    172 Views
    No one has replied
  • How can i change the combobox style to macintosh?

    Unsolved
    6
    0 Votes
    6 Posts
    483 Views
    SGaistS
    On what platform are you ? You can't reuse every style on every platform because they contain platform specific code. Also having a macOS style combo box on Linux or Windows would be pretty awkward...
  • Some kind of drag'n'drop and "linking" in a GUI

    Unsolved
    4
    0 Votes
    4 Posts
    310 Views
    mrjjM
    @Tempas Hi There is also https://forum.qt.io/topic/104100/diagram-schematic-components-library
  • 0 Votes
    1 Posts
    427 Views
    No one has replied
  • Qt mismatch of coordinates

    Unsolved
    2
    0 Votes
    2 Posts
    227 Views
    Kent-DorfmanK
    It is late-oclock and I'm lazy so not reading your code, but the general reason people have problems with coordinates is because they forget that coordinates are relative to the parent widget, not global screen coordinates.
  • How to unblock signals when mouse button is down?

    Solved
    8
    0 Votes
    8 Posts
    647 Views
    mrjjM
    Hi You could also just make a custom widget that paint the cells as you want. #ifndef CELLWIDGET_H #define CELLWIDGET_H #include <QPainter> #include <QResizeEvent> #include <QWidget> #include <QDebug> struct Cell { QRect rect; QColor color{Qt::gray}; }; class CellWidget : public QWidget { Q_OBJECT int numCols; int numRows; int cellWidth; int cellHeight; std::vector<Cell>Cells; bool pressed = false; public: explicit CellWidget(QWidget *parent = nullptr, int nCols = 8, int nRows = 8 ) : QWidget(parent), numCols(nCols), numRows(nRows) { } void Layout() // calculate the cells { int y = 0; cellWidth = width() / numCols; cellHeight = height() / numRows; Cells.clear(); Cell tmp; for (int rows = 0; rows < numRows; ++rows) { int x = 0; for (int cols = 0; cols < numCols; ++cols) { //qDebug() << "col=" << cols << "- row=" << rows; tmp.rect.setCoords(x, y, x + cellWidth, y + cellHeight); Cells.push_back(tmp); x += cellWidth; } y += cellHeight; } } signals: protected: virtual void mouseMoveEvent(QMouseEvent *event) override { if (pressed) { for (Cell &cell : Cells) { // find cell under mouse if (cell.rect.contains(event->pos()) ) { cell.color = Qt::yellow; update(); continue; } } } } virtual void paintEvent(QPaintEvent *) override { QPainter p(this); for (const Cell &cell : Cells) { p.setBrush( cell.color); p.drawRect( cell.rect ) ; } } virtual void resizeEvent(QResizeEvent *event) override { Layout(); } virtual void mousePressEvent(QMouseEvent *) override { pressed = true; } virtual void mouseReleaseEvent(QMouseEvent *) override { pressed = false; } }; #endif // CELLWIDGET_H [image: drop4.gif]
  • Multithreading and QProgressBar

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    nageshN
    @BobDon one solution would be as follows. 1)get the count of files that is being opened simultaneously. 2)If say 6 files are opened, you can set step count as 6*100 = 600 3)Each processing thread should check filesize and report the delta processed in percentage wise. 4)Accumulate the percentage progress reported from each thread and update the value in Progressbar
  • Use of variables in MainWindow.h

    Unsolved
    14
    0 Votes
    14 Posts
    2k Views
    S
    @RogerBreton Getters and setters are a thing that C++ books recommend. Personally, I don’t strictly follow that rule because it turns the code very verbose. It’s up to you but OOP people will hate you. Sometimes, I just want to read a variable from one class and give it to another. For example: SomeClass1 a; CubeClass b; a.thing=5; b.chocolate=a.thing; Anyway, that’s up to you. In C++, by default, like JonB said, your member functions and member variable are private. Sounds like you want to declare them as public. For structs, by default, they are public. I think what you want to do is to declare an instance of SomeClassName in your MainWindow class. And then, the code becomes SomeClassName TheObject; if (SUCCESSFUL(sdkError)) { TheObject.bWhiteCalibEndFlag = true; }