Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.5k Posts
  • Open hikcamera

    Unsolved
    6
    0 Votes
    6 Posts
    399 Views
    L
    @jsulm @jsulm void MainWindow::on_openCamera_clicked() { try { static QTimer qTimer ; if ( bContinue ) { qTimer.stop(); QObject::disconnect(&qTimer, SIGNAL(timeout()),this, SLOT(showPicture())) ; ui->openCamera->setText("open"); ui->status_label->setText("Trạng thái máy ảnh: Tắt"); } else { QObject::connect(&qTimer, SIGNAL(timeout()),this, SLOT(showPicture())) ; qTimer.start(100); ui->openCamera->setText("close"); ui->status_label->setText("Trạng thái máy ảnh: Bật"); } bContinue = !bContinue ; } catch( exception const &e ){ ui->status_label->setText("ERROR"); } }
  • FPS slows down when not resizing window

    Solved window freezing opengl openglwidget
    2
    0 Votes
    2 Posts
    522 Views
    Pl45m4P
    @Hyperspider-Software Resizing and moving the window will cause updates, renders and repaints. If everything is done and nothing changes, it doesn't have to get updated at such high rate as it would, when you grab the window and move it around and change dimensions of the content. Just a guess. Maybe it might be helpful if you show some code, how the window is rendered. Is it just one window or does everything behave like this?
  • How to get the metadata of a file (an image) in Qt

    Unsolved
    3
    0 Votes
    3 Posts
    749 Views
    lincolnL
    @ChrisW67 Ahh, ok good info thanks, I'll take a look at that library; thank you.
  • How to share data between processes using QSharedMemory?

    Unsolved
    15
    0 Votes
    15 Posts
    2k Views
    Kent-DorfmanK
    @Roberrt Read characteristics are undefined if you don't guarantee exclusive access, or at least use data types that are guaranteed to be atomic. Generally the read of a native word sized int is atomic across architectures because the CPU microcode likes to deal with a whole word at a time, and preemption wont occur in the middle of a machine code instruction. But it is safer to lock for reads as well.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Adding #define to main .pro

    Unsolved
    3
    0 Votes
    3 Posts
    576 Views
    A
    @Paul-Colby Thanks for the reply. Just for sake of discussion - what would be the benefit of adding EXTRA file to EACH suboproject ? Besides it does not meet the post " specification" to " add single place to control preprocessor" to main .pro. Cheers
  • How to scale a progress bar

    Unsolved
    5
    0 Votes
    5 Posts
    2k Views
    JonBJ
    @DatGK https://codebrowser.dev/qt5/qtbase/src/widgets/widgets/qprogressbar.cpp.html#424 QFontMetrics fm = fontMetrics(); QStyleOptionProgressBar opt; initStyleOption(&opt); int cw = style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &opt, this); QSize size = QSize(qMax(9, cw) * 7 + fm.horizontalAdvance(QLatin1Char('0')) * 4, fm.height() + 8); if (opt.orientation == Qt::Vertical) size = size.transposed(); So qMax(9, cw) * 7 + fm.horizontalAdvance(QLatin1Char('0')) * 4. I think the gist is 63+-odd for the chunks (7 chunks) + 4 character 0s. Then in your case this is applied for the height instead of the width. May be quite close to 95-odd pixels.
  • QT MQTT 3.1 vs 5.0

    Solved
    5
    0 Votes
    5 Posts
    375 Views
    L
    @SGaist You are right.. I missed that completely. m_client = new QMqttClient(this); m_client->setHostname(ui->lineEditHost->text()); m_client->setPort(ui->spinBoxPort->value()); m_client->setProtocolVersion(QMqttClient::MQTT_5_0); Thank you very much for quick help
  • Hosting MSFT WebView2 browser control in a QT QWidget

    Unsolved qwidget qt6 native
    1
    1 Votes
    1 Posts
    643 Views
    No one has replied
  • Display image in qml Rectangle

    Unsolved
    2
    0 Votes
    2 Posts
    313 Views
    Pl45m4P
    @Queen Something like this should work: Rectangle { width: 100 height: 400 Image { id: img1 source: "YourImage.png" // path to image or qrc resource path } }
  • How to get a long variable from QVariant

    Unsolved
    2
    0 Votes
    2 Posts
    333 Views
    Christian EhrlicherC
    Then use QVariant::value<long>(). But since sizeof(long long) = sizeof(long) on all 64 bit platforms - why do you need it?
  • How to create custom text within bar graphs?

    Solved
    2
    0 Votes
    2 Posts
    962 Views
    O
    @orsini29 Found it.. super simple and knew I'd kick myself over it. For anyone in the future, you need to use series->setLabelsFormat("@value enter text here"); Documentation: https://doc.qt.io/qt-6/qabstractbarseries.html#labelsFormat-prop
  • Qt6 RHI alpha texture support ?

    Unsolved
    1
    0 Votes
    1 Posts
    123 Views
    No one has replied
  • Qt DllMain doesn't get called

    Unsolved
    7
    0 Votes
    7 Posts
    964 Views
    jsulmJ
    @Ylvy said in Qt DllMain doesn't get called: what you mean mix debug and release build? I mean that if your application is built in debug mode you can't load DLLs built in release mode
  • This topic is deleted!

    Solved
    4
    0 Votes
    4 Posts
    33 Views
  • how to simplify convoluted UI signals?

    Solved
    7
    0 Votes
    7 Posts
    571 Views
    M
    In the end I refactored mediator QtObject from QML into a C++ QObject. However, I am surprised sender() returns NULL. Maybe it is so because I connect slots in QML with Connections on mediator instance set as a context property. Perhaps if I were to use QObject::connect() in C++ instead, sender() might have worked as expected.
  • Different property type for enum in 5.15/6.5

    Unsolved enum property qvariant qt5 qt6
    9
    0 Votes
    9 Posts
    2k Views
    crueeggC
    @kshegunov I have ~80 classes, each with 5-10 different properties (enums, POD, custom types, containers). The problem are all implicit (in a loop) conversions of these properties.
  • QStandardItem setData does not work

    Unsolved qvariant qstandarditem
    2
    0 Votes
    2 Posts
    522 Views
    JonBJ
    @johnco3 I'm afraid I know nothing about std::variant, but a couple of observations. Your setData() is void. QStandardItemModel's is bool. Have you checked the return result when you call that, you never know if it might be barfing? Your setData() defaults to Qt::UserRole + 1. How does your item->data().value<PortVariant>() pass that role to fetch? setData() copies its argument. I assume the equivalent code to test would be something like: PortVariant portVariant = port; QVariant v = QVariant::fromStdVariant(portVariant); QVariant v2 = v1; const auto& portVariant = v2.value<PortVariant>(); How does that come out? You might also call QVariant::canConvert<>() to check, including on your item->data(). I assume all the various component types in your structs are serializable to QVariant without further registration.
  • Display a custom ellipsis when text is elided

    Unsolved qstring elision ellipsis
    3
    0 Votes
    3 Posts
    892 Views
    S
    @Chris-Kawa Thanks for the quick reply! It might be helpful, I will think whether I can use it to my advantage.
  • QFileDialog QTranslator

    Unsolved
    4
    0 Votes
    4 Posts
    383 Views
    R
    Update to the DeprecationWarning: Using QLibraryInfo.path(QLibraryInfo.LibraryPath.TranslationsPath) the warning is gone.