Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.2k Topics 455.4k Posts
  • Controls Events

    Unsolved
    6
    0 Votes
    6 Posts
    350 Views
    J
    @JonB said in Controls Events: @jenya7 I don't think Qt Creator (I don't use it) provides a drag-and-drop interface to creating one, but yes Qt provides a https://doc.qt.io/qt-5/qfiledialog.html. From code you call one of its methods, you may be able to get away with the https://doc.qt.io/qt-5/qfiledialog.html#static-public-members ones for simplest purposes. Thank you.
  • QComboBox retains mouse hover highlight if you close popup

    Solved
    4
    1 Votes
    4 Posts
    636 Views
    L
    Ok, I managed to work around this issue, will write it here in case anybody else has this problem. I quit trying to use qss and did it in the code. Subclassed the QComboBox and added the hover events: bool TrackableComboBox::event(QEvent *event) { switch (event->type()) { case QEvent::Enter: this->setStyleSheet("background-color: rgba(0, 0, 0, 0.2);"); break; case QEvent::Leave: case QEvent::MouseButtonPress: this->setStyleSheet("background-color: -1;"); break; default: break; } return QWidget::event(event); } The secret here is to add Leave and MouseButtonPress reset the color, otherwise you will have the same issue.
  • This topic is deleted!

    Solved
    11
    0 Votes
    11 Posts
    11 Views
  • From commercial to open source licence

    Unsolved
    2
    0 Votes
    2 Posts
    200 Views
    jsulmJ
    @Loic-B You can skip entering your account when installing Qt, then it will be OSS version.
  • How to discovery connected BLE device on MacOS

    Unsolved
    1
    0 Votes
    1 Posts
    139 Views
    No one has replied
  • How to print multiple pages in one document using QPrinter and QWebView.

    Unsolved
    1
    0 Votes
    1 Posts
    214 Views
    No one has replied
  • How to remove elements from QStringList by comparing each other members.

    Solved
    15
    0 Votes
    15 Posts
    1k Views
    A
    @Chris-Kawa Thanks
  • multiple new ui classes need delete?

    Solved
    7
    0 Votes
    7 Posts
    512 Views
    PsnarfP
    Obquote: "All I know is what I read in doc.qt.io." I learned that QImage is among the list of Implicitly Shared classes which can be passed to functions by value and returned from functions without concern for copying overhead. Must take care with STL-style iterators, though. I missed that feature when I first started using QImages. I'm going to re-write my trig utility classes as QObjects without Ui. https://doc.qt.io/qt-5/objecttrees.html Should it be of concern to anyone, QtMath trig functions take qreal arguments in radians, not degrees. Doc mentions the return values as radians, but not the arguments. Thanks again for your help! I'm now a little-smarter dummy.
  • QTreeView focus events and losing selection

    Unsolved qtreeview
    4
    0 Votes
    4 Posts
    2k Views
    CKurduC
    You can subclass QTreeView and override setSelection. Firstly don't forget to set the multiselection mode. view->setSelectionMode(QAbstractItemView::MultiSelection); Override the setSelection method. #define MAX_SELECT 3 void TreeView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) { if(command & QItemSelectionModel::Deselect) { QTreeView::setSelection(rect,command); return; } if(command & QItemSelectionModel::Clear) { //Actually purpose this "if branch" to disable clear //but MultiSelection mode already do that so execute below command is normal. QTreeView::setSelection(rect,command); return; } QModelIndexList ls = this->selectedIndexes(); int total = 0; for(int i=0; i< ls.size();i++) { if(ls[i].column() != 0) continue; QModelIndex p = ls[i].child(0,0); if(!p.isValid()) { //I think when p is invalid ls[i] doesn't have any child. Maybe there is an another way to find this. total++; }else{ QString child_data = p.data().toString(); } } if(total < MAX_SELECT ) { QTreeView::setSelection(rect,command); }else{ //You can scroll here. } return; }
  • QMatrix, QColor wishlist

    Solved
    7
    1 Votes
    7 Posts
    860 Views
    SGaistS
    Hi, Note that there is nothing wrong mixing in other libraries for image processing and only do the display with Qt. You might also want to consider OpenCV for exemple. If you take the Krita project for example, the core of the application is Qt but they are using also other tools for image processing.
  • Groupbox occupies Whole Space on QMainWindow

    Solved
    4
    0 Votes
    4 Posts
    360 Views
    SGaistS
    That's correct there's one central widget but it can be composed of many widgets. Then you can also use the docker widgets.
  • Matplotlib interfering with PyQt

    Solved matplotlib pyqt5
    5
    0 Votes
    5 Posts
    2k Views
    SGaistS
    Thanks for the feedback and happy hacking !
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Form too long. I can't see data that is off screen

    Solved
    7
    0 Votes
    7 Posts
    427 Views
    Alexandre CameloA
    @SGaist Thank you so much, SGainst! Your comment also helped me! :-D
  • Make an .exe file in linux terminal

    Unsolved
    6
    0 Votes
    6 Posts
    592 Views
    S
    @aha_1980 Hi , Dear friend. Thanks a lot.
  • QML Settings not saved when using window close button

    Unsolved
    1
    0 Votes
    1 Posts
    210 Views
    No one has replied
  • Visual Studio qml syntax higlighting

    Solved
    6
    1 Votes
    6 Posts
    7k Views
    MikhailGM
    Highlighting has implemented but code completion has not yet.
  • QThread with SQLite blocks GUI

    Solved
    6
    0 Votes
    6 Posts
    563 Views
    NiagarerN
    @CKurdu said in QThread with SQLite blocks GUI: Because you are sending many update progress messages to the main thread. Maybe you can implement like below code in two places ( run and saveMetaData_currentWeather methods) Oh yes, this is actually the problem. It's not the updateProgress, but this line above in CurrentWeatherWorker::run(): emit log("data object read"); Because reading the data is done really fast and about 170 000 calls in about 10 seconds seems too be to much to handle for the mainwindow (the message gets printed every time). The queue of the received signals is just too long. Anyway, changing the updateProgress to something like this: if(i%(metaList.length()/100)==0) emit updateProgress(qRound(100.0*(qreal)i/(qreal)metaList.length())); should increase performance sagnificantly while the result should stay the same. @Christian-Ehrlicher said in QThread with SQLite blocks GUI: This is wrong when you're more than one db connection - you want 'QSqlQuery query(db)' Yes, thanks. So far it even works the old way since I am only working on one database at a time yet, but I plan to run multiple workers simultaneously. Thank you!!
  • Inserting data into SQLite DB via QSqlQuery::addBindValue not working

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    Christian EhrlicherC
    @Niagarer said in Inserting data into SQLite DB via QSqlQuery::addBindValue not working: but when using tables even bigger than this one When you have columns larger than that your design is bad - and you should not generate such kind of stuff by hand. But it's not my project :)
  • Directory Image Browser with Separators Help

    Solved
    5
    0 Votes
    5 Posts
    270 Views
    N
    Thank you. That looks like what I need to do. I think I need to put each directory and file list in a frame. The top-level view would just manage the directory frames.