Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Get QDialog be its title (or name)

    Solved
    9
    0 Votes
    9 Posts
    807 Views
    mrjjM
    @Please_Help_me_D well even im so called experienced, it also took me a while to think in terms of signals and slot where i would normally have a pointer to "the other class" But it really is much better as the 2 classed dont even have to know each other and the slot will have direct access to the UI / widgets which outside pointer will not - so to send the data via a signal is good design in most cases. Also you can easily write a test object that you connect to instead and it can automatic send some test data. The ColorBarWidgetMain wont know the difference. So its a more decoupled Design which is good for maintenance and adding features as nothing breaks even if you change the dialog. it still just have to emit the signal and no other class needs to know about any internal changes.
  • Printing QTextDocument in different thread distorts image.

    Solved
    6
    0 Votes
    6 Posts
    523 Views
    A
    @gde23 said in Printing QTextDocument in different thread distorts image.: What I would try is something like this, but as I said its just a guess... void AbstractEcoForm::printDocument() { std::unique_ptr<QTextDocument> printDoc(new QTextDocument); std::unique_ptr<QPrinter> printer(new QPrinter); printDoc->setPageSize(QSizeF(printer->pageRect().size())); setDocumentData(printDoc.get()); printer->setPrinterName(mCurrentPrinter); QString numeDoc = QStringLiteral("Test-print"); printer->setDocName(numeDoc); QPrinterInfo printerInfo(*printer); if (printerInfo.isNull()) { emit printerError("Nu este setata nici o imprimanta!"); return; } if (!printer->isValid()) { emit printerError("Imprimanta setata nu este valida!"); return; } QTimer::SingleShot(10, this, SLOT(printTheDocument()); where printTheDocument() is a slot that calls the printDoc->print(printer.get()); of your original code And I'm back :D, seems while the code somehow works and the app doesn't crash I get the following warning: QObject: Cannot create children for a parent that is in a different thread. (Parent is QTextDocument(0x10f7a800), parent's thread is QThread(0x143b22b8), current thread is QThread(0x12e10d0) Edit:: I gave up on QtConcurrent and went with QueuedConnection connection. Thank you.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    48 Views
    No one has replied
  • Select whole row in QTableWidget when radio button is checked

    Solved
    12
    0 Votes
    12 Posts
    3k Views
    P
    @Christian-Ehrlicher Thanks for the suggestion. Still I consider a custom delegate an overkill for such simple functionality, as my table is fairly simple and it will not contain more than a dozen rows. @anil_arise Thank you for the code. I will try that too. In the meantime, I found a solution. The problem and the confusion was that when a radio button (or checkbox) is checked, two toggled signals are emitted -one for the radio button actually clicked and one for the previously checked radio button which changes to unchecked, as the buttons are set to autoExclusive. So, I worked with the model indexes and got the result I wanted (note that in the end I opted for a QCheckBox): void ServiceDialog::setActiveModel() { for (auto row = 0; row < ui->myTable->rowCount(); row++) { QCheckBox *box = qobject_cast<QCheckBox*>(ui->myTable->cellWidget(row,5)); if (box && box->isChecked()) { ui->myTable->setCurrentIndex(ui->myTable->model()->index(row,0)); ui->myTable->selectRow(ui->myTable->currentIndex().row()); theStringIwant = ui->myTable->item(ui->myTable->currentIndex().row(),0)->text(); break; } } ... }
  • Errors occur when building yaml-cpp in Windows

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    P
    Okay! I've fixed the problem! All I needed to do was remove C:/devkitPro/msys/bin/ from the System PATH in Environmental Variables and then disabled YAML_CPP_BUILD_TESTS in the Qt Projects Build Settings for yaml-cpp, and it worked! For some reason, GTest (Google Test Framework) doesn't build in MinGW, that's why it has that error.
  • How to have multiple QCompleters in one QLineEdit

    Unsolved
    9
    0 Votes
    9 Posts
    919 Views
    L
    Thanks but that seems complicated. I think I'll go the old fashion way and just use multiple combo-boxes each with its own completer.
  • error: ‘fromJSON’ is not a member of ‘QJsonDocument’

    Unsolved
    4
    0 Votes
    4 Posts
    274 Views
    V
    Thanks, I start using an IDE
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • QML Table View with itemdelegate and row delegate

    Unsolved
    3
    0 Votes
    3 Posts
    853 Views
    R
    Hmmm, let me research some more on that. If the model is a QSqlModelQuery not quite sure how to expand the model.
  • [vsaddin] What's needed to do to update existing projects to use property pages

    Unsolved
    2
    0 Votes
    2 Posts
    227 Views
    Chris KawaC
    If you select the project in solution explorer and go to Extensions -> Qt VS Tools there's an option to convert your project: Convert custom build steps to Qt/MSBuild.
  • Any Good Git Client Suggestion

    Unsolved
    6
    0 Votes
    6 Posts
    665 Views
    S
    Before switching to GIT we have used (in both companies I have made this transition) TortoiseSVN. So, it was an obvious choice to go with TortoiseGIT. However, we have a very simple tree structure (we rarely use branches) which does not require more advanced visualization techniques. Other than that it does its job. TortoiseGIT requires to install the GIT command line tools for Windows separately. Then, also Qt Creator (and I believe Visual Studio as well) has a lot of GIT features already integrated. I do use at least GIT blame and GIT log from Qt Creator quite often.
  • QQuickWidget touch

    Unsolved
    5
    0 Votes
    5 Posts
    615 Views
    J
    @jsulm said in QQuickWidget touch: t is scene here? QGraphicsScene scene; scene.setSceneRect(0, 0, 1920, 1080); QGraphicsView view(&scene); view.show();
  • How to get QTextEdit Text minimum Height ? I Want use ScrollBar..

    Unsolved
    5
    0 Votes
    5 Posts
    711 Views
    P
    @SGaist https://forum.qt.io/topic/112598/how-to-get-fit-size/1 I want to do it like the above article. Setting toPlainText returns a smaller size than desired The scroll bar is still visible.
  • QPushButton icon hover effect in Qt v4.8

    Unsolved
    2
    0 Votes
    2 Posts
    423 Views
    SGaistS
    Hi, Can you explain in more details what exactly your are expecting from that effect ?
  • Does QSqlTableModel::select emit dataChanged/rowsInserted signals?

    Unsolved
    3
    0 Votes
    3 Posts
    303 Views
    JonBJ
    @yetanotherqtfan said in Does QSqlTableModel::select emit dataChanged/rowsInserted signals?: then call QSqlTableModel::select to reload the model. I expect dataChanged/rowsInserted signal emitted but it is actually not. I thought (quite untested) that this would emit QAbstractItemModel::modelReset(), because it throws away all existing rows and starts again, so wouldn't bother with dataChanged/rowsInserted etc.?
  • Tesseract in QT Ubuntu

    Unsolved
    2
    0 Votes
    2 Posts
    199 Views
    Pablo J. RoginaP
    @Kartashow it's not a good issue description... please state Qt version, OS, Tesseract version, post your .pro file, and more information about your environment and how you're trying to do the integration. Are you following any tutorial/guide to do the integration? if so please share the reference
  • QSqlTableModel::select() override

    Solved
    9
    0 Votes
    9 Posts
    680 Views
    I
    @JonB QSqlTableModel::selectionChanged() does not exist. It is just a signal which I implemented. That is the reason why I wanted to override the QSqlTableModel::select() slot. Sorry for the confusion. mysqltablemodelreadonl.h class MySqlTableModelReadOnly : public QSqlTableModel { Q_OBJECT public: explicit MySqlTableModelReadOnly(QObject *parent = nullptr); private: signals: void selectionChanged(); public slots: bool select() override; }; mysqltablemodelreadonl.cpp MySqlTableModelReadOnly::MySqlTableModelReadOnly(QObject *parent) : QSqlTableModel(parent) { } bool MySqlTableModelReadOnly::select() { bool result = QSqlTableModel::select(); emit this->selectionChanged(); return result; }
  • Getting started with ixxat CAN driver

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    G
    Hi, I implemented a simple driver for the missing PLUGIN for IXXAT USB adapter. It is freely available here: https://github.com/gmarescotti/ixxatcan
  • Edit a QString

    Unsolved
    5
    0 Votes
    5 Posts
    566 Views
    Pablo J. RoginaP
    @QtFranchise so is your issue solved? please don't forget to mark your post as such!
  • How to get fit size ??

    Unsolved
    1
    0 Votes
    1 Posts
    223 Views
    No one has replied