Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • Save values to a config file

    Solved
    43
    0 Votes
    43 Posts
    8k Views
    S
    Hi @J-Hilk, thank you so much for the example. I've looked on your GitHub repos and I see that you have more examples I could use in the future. Anyway thanks for making the example.
  • Switching between four UI forms

    Unsolved
    6
    0 Votes
    6 Posts
    497 Views
    JKSHJ
    The section that @artwaw mentioned is at https://forum.qt.io/category/58/qt-for-python
  • Part of a dialog window as transparent

    Unsolved
    2
    0 Votes
    2 Posts
    222 Views
    JoeCFDJ
    something like this https://forum.qt.io/topic/103580/fading-to-transparent-gradient/2
  • QLabels have same width regardless of text?

    Unsolved qlabel layout widget
    9
    0 Votes
    9 Posts
    4k Views
    H
    @eyllanesc Oh I see, it's working now. Thank you!
  • windeployqt insisting executable is debug

    Solved
    3
    0 Votes
    3 Posts
    693 Views
    M
    I was able to do that as a workaround but in all my uses of windeploy qt i have never had to use that argument.
  • When come many signals, slot waits for finish and it starts another

    Solved
    3
    0 Votes
    3 Posts
    247 Views
    artwawA
    @Bondrusiek What exactly is your question? Behaviour you described is sound, works as it should. If you'd like to modify the default behaviour please see https://doc.qt.io/qt-5/qt.html#ConnectionType-enum for options available.
  • Custom Circle Progress Bar

    Unsolved
    6
    0 Votes
    6 Posts
    6k Views
    M
    @moutasdimitris Not so easy ;) void Widget::paintEvent(QPaintEvent* ev) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing,true); QRect rec=rect(); int minWidth=qMin(rec.width(),rec.height())/2; int thickness=minWidth/6; rec.adjust(thickness,thickness,-thickness,-thickness); minWidth=qMin(rec.width(),rec.height())/2; QConicalGradient gradient(rec.center(),90); gradient.setColorAt(0,Qt::transparent); gradient.setColorAt(.5,QColor(25,180,255)); QPainterPath path; path.addEllipse(rec.center(),minWidth,minWidth); QPainterPath clipPath; clipPath.addEllipse(rec.center(),minWidth-thickness,minWidth-thickness); path=path.subtracted(clipPath); int segNum=8; // number of segments int radius=minWidth+1; int t=thickness/4; // inter segment width int cx=rec.center().x(); int cy=rec.center().y(); for(int i=0; i<segNum; i++) { // calculate inter segment pos float angle=180.0/segNum*i+90; float cos1=qCos(qDegreesToRadians(angle)); float sin1=qSin(qDegreesToRadians(angle)); float cos2=qCos(qDegreesToRadians(angle+180)); float sin2=qSin(qDegreesToRadians(angle+180)); float x1=cx+radius*cos1; float y1=cy-radius*sin1; float x2=cx+radius*cos2; float y2=cy-radius*sin2; QPainterPath line; line.moveTo(x1-sin1*t,y1-cos1*t); line.lineTo(x1+sin1*t,y1+cos1*t); line.lineTo(cx,cy); line.lineTo(x2-sin2*t,y2-cos2*t); line.lineTo(x2+sin2*t,y2+cos2*t); path=path.subtracted(line); // subtract inter segment //painter.fillPath(line,Qt::white); } painter.fillPath(path,gradient); }
  • default style of 6.2 looks defect :(

    Unsolved
    8
    0 Votes
    8 Posts
    826 Views
    D
    @mrjj said in default style of 6.2 looks defect :(: Normally you would add QApplication::setAttribute(Qt::AA_DisableHighDpiScaling); Before the app in main.cpp but as far as I know the env also works. I couldn't try that before - so did the test right now - and it looks, that Qt6.2 does not have any attribute like "AA_DisableHighDpiScaling". I got compiler errors, so I guess, environment variable can't work either. I searched a bit for similar attributes and found "Qt::HighDpiScaleFactorRoundingPolicy::Ceil" - but using this attribute does not change anything.
  • QGridLayout spacing and margins

    Solved
    2
    0 Votes
    2 Posts
    312 Views
    SPlattenS
    @SPlatten , solution was to flip alignments: pgrdloStatus->addWidget(mpsvgRxIcon, 1, 0, 1, 1, Qt::AlignRight); pgrdloStatus->addWidget(mpsvgTxIcon, 1, 1, 1, 1, Qt::AlignLeft);
  • MainWindow as modal

    Unsolved
    3
    0 Votes
    3 Posts
    227 Views
    JonBJ
    @cjacquel2021 A dubious desire. If you somehow mean this will "disable clicking outside the application" it won't.
  • qDialog move in front of all Windows window

    Solved
    3
    0 Votes
    3 Posts
    518 Views
    KaguroK
    @mrjj Hi! Thanks it works! Sorry i was so lame :D I added this way: setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint); And its on top and keep the transparent background with framless window, Thanks! :)
  • QSvgWidget, how to modify element

    Solved
    4
    0 Votes
    4 Posts
    663 Views
    mrjjM
    @SPlatten Well if you can tag the element you want with known ID it's much easier to find the right one. QDomElement element = elm.toElement(); QString attribute = element.attribute("id"); if(attribute == "tspan4167") { ....
  • Translate a single QString

    Solved
    8
    0 Votes
    8 Posts
    958 Views
    D
    @eyllanesc Thank you. I got it. With the full path it works void Translate::translate() { QTranslator translator; if(!translator.load(qApp->applicationDirPath() + "/ConsoleTranslationExample_de_DE.qm")){ qDebug() << "Cant find translation file"; return; } qApp->installTranslator(&translator); QString message = tr("Hello"); QTextStream o(stdout); o << message; }
  • setStylesheet = Qss file

    Unsolved
    5
    0 Votes
    5 Posts
    865 Views
    K
    @eyllanesc [image: 88778368-0e85-47e4-9376-a2f76c2fedd7.png] EDIT: i just ran qmake and now it fixed itself...
  • QSvgWidget in QGridLayout

    Solved
    2
    0 Votes
    2 Posts
    243 Views
    SPlattenS
    @SPlatten , fixed: QGridLayout* pgrdloStatus(new QGridLayout); if ( mplblStsIcon == nullptr ) { mplblStsIcon = new QLabel(); } if ( mpsvgRxIcon == nullptr ) { mpsvgRxIcon = new QSvgWidget(":/SVG_LED"); mpsvgRxIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mpsvgRxIcon->setFixedSize(TraineeMonitor::mscuintCommsIconWidth, TraineeMonitor::mscuintCommsIconHeight); } if ( mpsvgTxIcon == nullptr ) { mpsvgTxIcon = new QSvgWidget(":/SVG_LED"); mpsvgTxIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mpsvgTxIcon->setFixedSize(TraineeMonitor::mscuintCommsIconWidth, TraineeMonitor::mscuintCommsIconHeight); } const QString cstrToolTip(QString( " Hostname: %1\r\nMAC address: %2") .arg(mstrHostname).arg(mstrMACaddress)); mplblStsIcon->setToolTip(cstrToolTip); pgrdloStatus->addWidget(mplblStsIcon, 0, 0, 1, 2, Qt::AlignHCenter); pgrdloStatus->addWidget(mpsvgRxIcon, 1, 0, 1, 1, Qt::AlignLeft); pgrdloStatus->addWidget(mpsvgTxIcon, 1, 1, 1, 1, Qt::AlignRight); return pgrdloStatus; Adding size policy fixes it, doh!
  • How to set different text for a QDockWidget's tab and window title?

    Unsolved
    3
    0 Votes
    3 Posts
    352 Views
    X
    Hi, First, thank you for your answer ! AFAIK this signal allows to know when the window is floating or not. Unfortunately, I do not see how to use it to change the name in the bottom red circle of the picture and not the title in the top red circle of the previous picture. I would like to "unlink" the two names in the red circle of the picture in the #1 message.
  • Conversion of PCL (Printer Control Language) data to QImage/QPixmap

    Unsolved
    3
    0 Votes
    3 Posts
    224 Views
    D
    Thank you for the information. I wasn't aware that this software is (still) freely available. I will give it a try. A friend of mine has only very old software that does not handle all HP/Agilent/Keysight scopes. That's why I wanted to write something that handles the three generations of oscilloscopes that we have. Ralf
  • which ide is better to development of qtbase project?

    Unsolved
    2
    0 Votes
    2 Posts
    197 Views
    sierdzioS
    Try asking on Qt Interest mailing list, you may get more responses there. I think most of the time, contributors open subprojects and not the whole module; or they don't use IDEs at all. But I'm just guessing.
  • How set Qtwidget as a parent for Qtvirtual keyboard

    Unsolved
    2
    0 Votes
    2 Posts
    156 Views
    SGaistS
    Hi, Can you show how things are going to be implemented ?
  • Prevent QDragEnterEvent from being propagated to parent?

    Unsolved
    8
    0 Votes
    8 Posts
    1k Views
    SGaistS
    An event that is ignored means that the current widget will not process it, thus it will go up the chain.