Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.3k Posts
  • QtTreePropertyBrowser / Getting mouse double click

    Unsolved
    7
    0 Votes
    7 Posts
    376 Views
    Pl45m4P
    @excelitas_pco Hi, do you inherit from QtTreePropertyBrowserPrivate directly? Might not be the best idea, since your widget depends on that specific Qt version as the internal Qt code may change just like that. Then your widget does not work anymore. The initial mouse double click hits QTreeView and not the widget I've derived from QtTreePropertyBrowser. Events always start at the innermost child widget at that position and then go bottom-up to the topmost. Probably the QTreeView "eats"/accepts the event, so the propagation ends there. If your code was "inpired" by the Qt source you can fix that, if you inherit the Qt private classes directly, you cannot.
  • How to select an ALPN protocol when using QSslSocket (TLS)

    Solved
    3
    0 Votes
    3 Posts
    251 Views
    Linus JahnL
    Ahhh okay, sorry, yeah I read that as "if you host a server, these are the allowed protocols clients can negotiate with it".
  • QSignalTransition setSignal

    Solved
    2
    0 Votes
    2 Posts
    113 Views
    R
    QByteArray sig = QMetaMethod::fromSignal(&MySender::echoStateChange) .methodSignature() .constData(); transition.data()->setSignal(sig);
  • How to make animated backgrounds?

    Unsolved
    24
    1 Votes
    24 Posts
    3k Views
    artwawA
    @Mizmas please check the release version of your program, the debug ones can be laggy for obvious reasons.
  • How to extract characters from QString...?

    Solved
    12
    1 Votes
    12 Posts
    938 Views
    S
    @JoeCFD said in How to extract characters from QString...?: Is it easier to use std::string to handle it and convert it to QString when needed? I had bad experiences with mixing QString and std::string. There have been times (on Windows with MSVC) where some references to std::string could not be found when using QString::toStdString(). Now, we have set the regular C++ locale to be UTF-8 (which means all std::strings are UTF-8). This also means that we need to use QString::fromUtf8(stdstring.c_str()) and qtstring.toUtf8().data() to convert between QString and std::string. (Under some circumstances the conversion from QString to std::string has some weird behaviour because of calling data() on a temporary object. It would be better to store the result of toUtf8() in a QByteArray before.) So, bad experiences with QString::toStdString/fromStdString() together with UTF-8 std::strings tell me it is not easier to go back and forth between std::string and QString. (Also, QString::mid() might have worse performance than QString::midRef(), but certainly better performance than converting back and forth.)
  • QPushButton default windows style sheet

    Solved qpushbutton sty stylesheet windows
    12
    0 Votes
    12 Posts
    10k Views
    Chris KawaC
    To remove stylesheet style simply set an empty string i.e. someWidget->setStyleSheet("border: 1px solid red; background-color: blue;"); // sets a stylesheet someWidget->setStyleSheet({}); // removes a stylesheet
  • which is better, MinGW64 or MSVC 2019 64bit for general use applications.

    Unsolved
    5
    0 Votes
    5 Posts
    800 Views
    S
    I have personally always been using MSVC on Windows and would always pick this as a compiler. The Visual Studio debugger is a lot better than the one built in to Qt Creator (debugging in Qt Creator can be terribly slow on Windows taking several minutes for just a single step). vc_redist can be a little bit annoying. However, when you are using an installer for your software this can be included as a dependency and will be fine. @Blackzero said in which is better, MinGW64 or MSVC 2019 64bit for general use applications.: if I use open source static it is not possible because my goal is for my own small commercial. This is not entirely true. In order to use open source static you need to compile Qt yourself. This is doable. The LGPL requires for the user to be able to relink with a different Qt version. As long as you are willing to provide your objects files (maybe already linked into a static library) together with an explanation of how to link to static Qt libraries, this is also feasible. Even though the LGPL provides these rights to the user, in general it is highly unlikely that anyone will make use of this right. This might be a risk you are willing to take (i.e. the risk that you never have to effectively provide a way for a user to relink with a different static Qt version because noone will ever make use of this right). (I'm not a lawyer; this is not legal advice.)
  • QComboBox/QStyledItemDelegate, Icon Size for selected item.

    Unsolved
    2
    0 Votes
    2 Posts
    222 Views
    P
    Here's an image of what I'm talking about, seem the spam filter doesn't stop it here. [image: d4ca4419-e1a6-497a-9b0b-a34f5e4c4844.png]
  • how to set responsive on large screen resolutions

    Unsolved
    4
    0 Votes
    4 Posts
    197 Views
    Christian EhrlicherC
    So either upgrade to a recent Qt6 version where high-dpi support is highly improved or try to play around with QT_SCALE_FACTOR and Qt::AA_EnableHighDpiScaling: https://doc.qt.io/qt-5/highdpi.html
  • Qt creator Update text file with input data

    Solved
    14
    0 Votes
    14 Posts
    872 Views
    JonBJ
    @Ruben12313 You (attempt to) "truncate" the file you are writing to as you write each line to it! You have a stream named in3 which is only used for output. If there are no lines now in the widget you fail to truncate/clear out any lines which were in the file (e.g. after deleting). Etc. It makes no sense. I leave it to you.
  • 0 Votes
    7 Posts
    351 Views
    JonBJ
    @Torch said in The application crashes after 3 seconds.I'm writing a task manager in qt with a database,.: Adding task: "Task 1" Error adding task: "Parameter count mismatch" Failed to add Task 1 So don't you think this code needs showing?
  • Frameless widget shakes during resizing

    Unsolved qt6 resize frameless c++
    3
    0 Votes
    3 Posts
    746 Views
    D
    I have the same problem, looking for someone to answer it.
  • 0 Votes
    2 Posts
    126 Views
    Axel SpoerlA
    Hi, that's a known issue, related to the touch screen driver for Windows. Not related to Qt.
  • How to fix inconsistent window placement?

    Solved
    3
    0 Votes
    3 Posts
    180 Views
    D
    @mpergand using size() would discard the height of the bottom dock and place the window behind it. However I found the solution to correctly calculate the position by using availableVirtualGeometry(). The returned QRect does take into account the top menu bar height and the calculation basically is now as follows: const auto geom = logWindow->screen()->availableVirtualGeometry(); //qDebug() << "avail virtual geo: " << logWindow->screen()->availableVirtualGeometry(); logWindow->resize(static_cast<int>(std::round(geom.width() * 0.75)), 240); logWindow->show(); logWindow->move(0, geom.height() + geom.y() - logWindow->frameGeometry().height()); This does work on both platforms.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    14 Views
    No one has replied
  • multiple plot management environment in pyqt

    Unsolved
    2
    0 Votes
    2 Posts
    146 Views
    SGaistS
    Hi, AFAIK, there's no "complete" plot handling pre-made widget. You can likely achieve what you want using Qwt. KDE's Labplot might be of help on your endeavor.
  • How to add a row to a subclass of QAbstractTableModel?

    Unsolved table view table model
    5
    0 Votes
    5 Posts
    656 Views
    Pl45m4P
    @Pl45m4 said in How to add a row to a subclass of QAbstractTableModel?: For more detail check out the Editable TreeView Example (it's TreeView but in general the insert/remove procedure of rows and cols is the same) https://doc.qt.io/qt-6/qtwidgets-itemviews-editabletreemodel-example.html @jdent see here
  • Manipulating characters within a QTextDocument/QAbstractTextDocumentLayout

    Unsolved
    4
    0 Votes
    4 Posts
    393 Views
    H
    In this book, there is explanation to subclass QAbstractTextDocumentLayout. https://www.amazon.co.jp/dp/B0D5BXJQBX?&linkCode=ll1&tag=multilinger19-22&linkId=6f566cae61fec736270f5086292ea57c&language=ja_JP&ref_=as_li_ss_tl
  • Is there a risk of crashing in the QImage::setColorSpace method?

    Unsolved qt6 qt5
    6
    0 Votes
    6 Posts
    691 Views
    Christian EhrlicherC
    The check in setColor() is not needed - if there is an oom the app will crash.
  • Unable to successfully import files with mix use of PySide6 and PyQt6

    Unsolved
    22
    0 Votes
    22 Posts
    3k Views
    JonBJ
    @explorer100 Somebody, somewhere did write some sort of Python upgrade script to find and replace all the occurrences of the old symbols with the new ones. I don't know how good it is, but maybe it comes with a list of those which need changing you can look through. I know I have referred to it in my posts here, but that was a long time ago. Whether I can find it again I don't know.... Oh, it's at https://stackoverflow.com/questions/72086632/migrating-to-qt6-pyqt6-what-are-all-the-deprecated-short-form-names-in-qt5. For PyQt5->6. There's a script to copy or a Py package to fetch. Or there's https://github.com/qutebrowser/qutebrowser/issues/5904#issuecomment-736792450. It seems they look through files supplied with PyQt rather than having a hard-coded list you could look at.