Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • CMake project configuration failed on fresh install.

    Solved
    2
    0 Votes
    2 Posts
    264 Views
    W
    Solved! I installed git and that seemed to do the job.
  • How to apply QLinearGradient on a round QWidget border using style sheet?

    Solved
    2
    0 Votes
    2 Posts
    683 Views
    C
    Since setting border radius using stylesheets has unwanted effects, you could make your widget borders round without it, and use paintEvent instead, here's how: You could draw a rounded rect with a color same as the widget parent's background, this acts as if it's hiding those sharp corners, and make them look round. One downside of this method is that it limits how round the corners can get, because if the painter draws a too rounded rect, it will mask the widget itself or cause sharp edges. It is possible to slightly get around that by increasing the border size, to get more space, thus, making it possible to increase the border radius when using a painter without ruining the widget edges. There is an upside for using this method. It prevents the widget background from poking out the border. Here's an example of subclass derived from QPushButton with a custom paintEvent: class button : public QPushButton { Q_OBJECT public: button (QWidget *parent = nullptr) : QPushButton(parent) {} protected: void paintEvent(QPaintEvent *event) override { QPushButton::paintEvent(event); QRectF r = rect(); r.adjust(-1,-1,+1,+1); QPainter p(this); QColor color = parentWidget()->palette().brush(QPalette::Window).color(); p.setPen(QPen(color,2)); p.setRenderHint(QPainter::Antialiasing); p.drawRoundedRect(r, 6, 6); } }; Here's the result, where the bottom button is a normal QPushButton with no border radius, just to increase the difference visibility: [image: XQPkv.gif]
  • How to set stylesheet on widgets containing a given string?

    Unsolved
    4
    0 Votes
    4 Posts
    357 Views
    Axel SpoerlA
    @Daniella Things can go wrong on parenting the widgets into each other. The child may inherit its parent’s stylesheet. In that case the parent probably has the same background color. So the only noticeable difference is padding. It also matters if test becomes true before or after the setting the stylesheet. If it happens afterwards, you have to enforce manual recomputing. Whatever it is, setting the child’s stylesheet (again), should solve both issues.
  • QOpenGLWidget update and grab in thread

    Unsolved
    7
    0 Votes
    7 Posts
    773 Views
    Chris KawaC
    @MfromOlsztyn As others said you can't render to a widget in any thread but main. For rendering in another thread use QOffscreenSurface instead of QOpenGLWidget, which creates a windowless surface and is specifically designed for this purpose.
  • This segfaults on MacOS Ventura on a M2 Max MBP.

    Unsolved
    6
    0 Votes
    6 Posts
    495 Views
    SGaistS
    Hi, Have a look at the Calling Qt Functions From Unix Signal Handers chapter in Qt's documentation. There are some considerations there that might also apply to your use case.
  • Drag tab between two QtabWidget

    Solved qtabwidget pyqt5 qt6.5 mouseevent drag and drop
    12
    0 Votes
    12 Posts
    2k Views
    M
    AS @JonB said, Python is a dynamic language, C++ is not. So, you need to make an explicit cast to retreive the type of object you want. If you expect e->source() to return a QTabWidget, you need to do: QTabWidget* tabWidget=qobject_cast<QTabWidget*>(e->source()); if(tabWidget) // is a tab widget ? ( // indeed it is ) else { // is not }
  • qextserialport write and progress bar

    Unsolved
    31
    0 Votes
    31 Posts
    5k Views
    A
    @another_one Thanks to all again! Finally I heard and do what I have chenged the following: in class qextserpw public: QByteArray global_data; signals: void inprogress(long data); void to_store(); void to_indi(QByteArray data); void qextserpw::m_readAll() { QByteArray temp; global_data = port->readAll();//&temp; emit to_indi(global_data); qDebug() << "read from another thread!"; } in main #include "monmk.h" #include "qextserpw.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); monMK w; w.show(); a.processEvents(); return a.exec(); } in class monMK void monMK::writeData() { unsigned long ii; bar->setRange(1, fls-1); bar->setValue(1); for(ii=0;ii<fls;ii++) { y = arr.mid(ii, 1 ); qextser->write(y); if(ii % fls == 0) qApp->processEvents(); emit load_pr(ii); QCoreApplication::processEvents(); qDebug() << "interation = " << ii; } } But in CentOS I still got some another problem which relates to form and widjets scale Widgets can not fit form as well as in windows
  • How to open Windows crash dumps?

    Unsolved
    8
    0 Votes
    8 Posts
    3k Views
    Youda008Y
    The QtCreator specifically says: "E:/DoomRunner.exe.20012.dmp" is not a core dump: file format not recognized Seems like a bug in QtCreator
  • QButton and QIcon don't work well together (?)

    Solved
    7
    0 Votes
    7 Posts
    472 Views
    O
    @JonB Thank you for your help. Indeed, as in a previous post, to my great shame going between projects I hadn't noticed that during cutting and pasting I changed the full pathname, and was debugging the wrong project !
  • QLineSeries::hovered

    Unsolved
    6
    1 Votes
    6 Posts
    1k Views
    PerdrixP
    @JonB This one looks like a point of view question and I'm not going to press the issue here. I've opened: https://bugreports.qt.io/browse/QTBUG-114996
  • QNetworkAccessManager not emitting readyRead or finished signal

    Unsolved
    11
    0 Votes
    11 Posts
    585 Views
    G
    @JonB @J-Hilk I have actually used another url which is https://accounts.spotify.com/api/token, this url can be successfully exceuted with the above code and get its return json, but the same code fails with http://localhost:8000/ or https://api.spotify.com/v1/me/player/currently-playing
  • 0 Votes
    35 Posts
    11k Views
    JonBJ
    @jsulm said in build QMYSQL driver under windows 10, a sample solution for QSqlDatabase: QMYSQL driver not loaded: using "export QT_DEBUG_PLUGINS=1". @cpplegend Since you are using Windows this would be set QT_DEBUG_PLUGINS=1 in a Command Prompt window.
  • 0 Votes
    2 Posts
    247 Views
    C
    I have commented on the bug. I could reproduce it with your file, but not another. This was with the MingW tool chain, which I think is also different.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • QT QChart can't show,refresh doesn't work

    Solved
    12
    0 Votes
    12 Posts
    2k Views
    P
    @JonB yes you are correct i solved the problem thanks a lot.
  • How to set up the right compiler ?

    Unsolved
    2
    0 Votes
    2 Posts
    160 Views
    jsulmJ
    @hutiien You probably will need to install older VS version or Microsoft Build Tools version which has this old compiler. Keep in mind that you probably will not be able to use latest Qt versions with this compiler.
  • Odd behaviour with QPen/QColor

    Solved
    3
    0 Votes
    3 Posts
    208 Views
    PerdrixP
    @jsulm Yep you're right I did miss the obvious Doh! Slap head! painter.setPen(pen) would help a lot!
  • Get the string between two delimiters only.

    Solved
    17
    0 Votes
    17 Posts
    3k Views
    M
    @JonB Hi, I have added the separator. Its working fine. Thank you everyone for your support.
  • 1 Votes
    2 Posts
    817 Views
    jsulmJ
    @hoarylea How did you install Qt? Also, C:\Qt\Tools\QtDesignStudio\qt6_design_studio_reduced_version\lib\Qt6Widgetsd.lib is not the correct lib to link. How did you configure your project?
  • size() and constData() of QByteArray

    Solved
    3
    0 Votes
    3 Posts
    227 Views
    J
    @Bonnie Understood! thank you for your help!