Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Unknown module(s) in QT: core gui widgets in Debian11(bullseye)

    Solved
    2
    0 Votes
    2 Posts
    2k Views
    sonichyS
    @sonichy sudo apt install qtbase5-dev
  • QTest crashes due to "qthread destroyed while thread is still running"

    Solved
    4
    0 Votes
    4 Posts
    515 Views
    SGaistS
    Hi and welcome to devnet, @xuwjuy1 said in QTest crashes due to "qthread destroyed while thread is still running": QGuiApplication app(argc, argv); That should not be part of your test code. QTest already provides an app object. See QTEST_MAIN.
  • How to use UI of one window to another window?

    Solved desktop uiofanother multiplewindow
    4
    0 Votes
    4 Posts
    944 Views
    goloviznin.kG
    @Aahi You don't have to use this old connection style. Remove SIGNAL and SLOT words. auto window2 = new MainWindow(); connect(ui->pushButton, &QPushButton::pressed, window2, &MainWindow::some_slot_that_you_have_in_MainWindow_class); some_slot_that_you_have_in_MainWindow_class() { ui->checkBox->setChecked(false); } Something like that
  • Install qt6 on a vps

    Unsolved
    2
    0 Votes
    2 Posts
    211 Views
    B
    Not really except Qt 6 might be installable through your package manager like apt, yum etc. Other option would be to compile Qt6 yourself on the VPS or install it on a machine with a UI and create your own package or plain copy all binaries.
  • How to force my development project to support only C++11 standard

    Solved
    11
    0 Votes
    11 Posts
    3k Views
    V
    @hskoglund : Never have I explored mkspecs directory before. Its good learning for me. I was not able to restrict my code to c++11 standards, but i was able to restrict my code to follow c++14 standard with MSVC compiler. I did setup QMAKE_CXXFLAGS += /std:c++14 in msvc2019\mkspecs\win32-msvc\qmake.conf file. And tried couple of c++17 standard supported code. Compiler error detected. Thanks for your time.
  • Writing to form fields from other files than mainwindow.h

    Solved
    3
    0 Votes
    3 Posts
    284 Views
    U
    Okay, so basically all manipulations of the form are done within the file.cpp/class to which it pertains? Thanks. I'll give it a try from that way.
  • QListWidget, itemSelectionChanged problem

    Unsolved
    4
    0 Votes
    4 Posts
    462 Views
    SPlattenS
    @Christian-Ehrlicher , Found the issue, it works now after commenting out this from the constructor: //Use "clsQtAskBeforeChange" to prompt user for confirmation if //changes in child nodes before allowing change //ABC = Ask Before Change clsQtAskBeforeChange* pobjABC(new clsQtAskBeforeChange(model(), this)); setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionModel(pobjABC); //Now the widget should be set-up, finalise set-up clsXMLinterface::setup(); This is a bit of a work in progress as I want to prompt the user for confirmation before allowing the new selection.
  • No SIGNAL from startDetached ?

    Unsolved
    3
    0 Votes
    3 Posts
    278 Views
    JonBJ
    @AnneRanch I took the time over at https://forum.qt.io/topic/133498/cannot-get-the-qprocess-started/17 to test and explain that the process.startDetached("hcitool dev>>/tmp/temp") which you believe is working for you is actually not, and is no different from using start() here which also won't work on that string. Did you read it?
  • QCamera example is missing references

    Unsolved
    3
    0 Votes
    3 Posts
    347 Views
    A
    @Christian-Ehrlicher So setting the "kits" to all - including 6.2.2. has no bearing on examples. So how do I know which version is running the examples in :IDE" ? I guess I'll get it from 5.12 to male sure it works. The Examples are 6.2.2 I have autodetect kit GCC 6.2.2 What is missing ?
  • QTimer Slot - time delta varies depending on Slot-Method content

    Unsolved
    5
    0 Votes
    5 Posts
    299 Views
    Christian EhrlicherC
    @Flaming-Moe I fixed your first post.
  • Cross compile Qt for Windows with MinGW64

    Unsolved
    3
    0 Votes
    3 Posts
    920 Views
    raven-worxR
    @ozaq this thread might help: https://forum.qt.io/topic/132307/qt6-cross-compile-for-windows
  • How to implemet "| tee " in "system" implementation in QProcess

    Unsolved
    7
    0 Votes
    7 Posts
    657 Views
    JonBJ
    @Kent-Dorfman I do not agree with this. By the time you choose to create a shell script to do the redirection symbol handling, you might as well use the -c argument to /bin/sh or /bin/bash. Creating the correct shell script, making it take the desired runtime parameters, and most importantly distributing/installing the script in the right place with the right permissions is itself problematic. (Having said that, a different plus point for a shell script is if at a later date or site you find you would like to change the commands or arguments it executes the end-user can edit it, instead of having them hard-coded into the program. It's just that it's more work to get it installed right.) The best way for this particular command is not to need to do any redirection on the command-line. Instead use QFile to manage the redirection in the calling application. Or maybe use QProcess::setStandardOutputFile(const QString &fileName, QIODevice::OpenMode mode = Truncate) with mode set to QIODevice::Append if desired. Personally by the time I am using Qt I would rather use its QProcess than the C library system() call, as I have more flexibility in its behaviour, especially in a UI application.
  • Read from the file twice

    Solved
    4
    0 Votes
    4 Posts
    834 Views
    JonBJ
    @luminski As @SGaist has said, if you really need to re-read an already-opened-and-partially-read file you can seek(0) to accomplish that. Alternatively: if the two reading segments of code are "close together", as per the code the show, you could: reverse the order of your operations, read the whole file first and get the first line from what you already read into memory instead of in.readLine(), like: if(!someFile.open(QIODevice::ReadOnly)) return; QByteArray dataFile = someFile.readAll(); QString wholeContent = QString(dataFile); someFile.close(); QString firstLine = wholeContent.split("\n").at(0);
  • Syntax for QspinBox connection

    Solved
    2
    0 Votes
    2 Posts
    284 Views
    JonBJ
    @summit I would guess void on_nameOfSpinBox_valueChanged(); because of void QSpinBox::valueChanged(int i). You are achieving this because of the behaviour of Qt Designer doing "auto-connects" of signals to slots based on what the widget is named and what the signal is named. This is generally considered inadvisable (e.g. try changing the name of your widget in Designer and see what happens), Despite the apparent convenience of this approach in Designer, most of us would suggest you simple do not use the signal/slot connection mechanism it offers and rather put the necessary connect() statements into your code explicitly instead.
  • How is parameter "QIODevice::OpenMode mode = ReadWrite" used in QProcess?

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    JonBJ
    @AnneRanch said in How is parameter "QIODevice::OpenMode mode = ReadWrite" used in QProcess?: OK. just humor me - where is is written that A QProcess is-a QIODevice? https://doc.qt.io/qt-5/qprocess.html : QProcess Class ... Inherits: QIODevice So if "mode" is set to "write" - do I still get the stdio /stderr from QProcess? No! Your calling application needs read access to the QProcess/QIODevice in order to read from its stdout/stderr, and it would need write access to in order to write to its stdin, if you need that for the particular command. That is why the default is QIODevice::ReadWrite, to allow either/both. In your particular case QIODevice::ReadOnly would work, but not QIODevice::WriteOnly.
  • Cannot get the QProcess started

    Unsolved
    17
    0 Votes
    17 Posts
    4k Views
    JonBJ
    @AnneRanch said in Cannot get the QProcess started: process.startDetached("hcitool dev>>/tmp/temp"); Apart from @KroMignon's correct point that you should not change to startDetached(). >> I believe you will find that your statement is not working, and you are mistaken in thinking it does. << I tested process.startDetached("ls -l >>/tmp/temp"); under Ubuntu 20.04, with Qt 5.12.x. After executing your line, if you look in QT Creator's Application Output pane you get: /usr/bin/ls: cannot access '>>/tmp/temp': No such file or directory Then I tried process.startDetached("hcitool dev>>/tmp/temp"); and the Application Output showed just Devices: In neither case is /tmp/temp created or written to. This is exactly as I would expect and have previously said above: you cannot use a redirection symbol like >> without going via a shell (/bin/sh or /bin/bash followed by -c and then the command). Which is what this whole thread is about. Since you don't, the command (ls or hcitool) sees a single argument of >>/tmp/temp, and cannot act on it correctly. I would guess you had the file /tmp/temp already created from a previous run, filled with previous hcitool output, and thought that meant your command had been successful and appended to it, but it had not. Start by rm /tmp/temp to ENSURE that file does not exist, and then try your startDetached() command again. It does NOT create that file, does it...?
  • QT5.15 make install problem - Could not find feature opengl

    Solved
    2
    0 Votes
    2 Posts
    550 Views
    M
    I solved it by adding -skip qtquick3d
  • How do I code for different widget passed ?

    Solved
    3
    0 Votes
    3 Posts
    328 Views
    A
    @mpergand Thanks works great.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • 0 Votes
    3 Posts
    918 Views
    BDC_PatrickB
    @JonB Thanks.. found out, that i needed to create a new Pointer in the Declaration of the .h File.. Means.. TGS_Widget_AssetList * _assetList; Wasn´t enough... I needed to do: TGS_Widget_AssetList *_assetList = new TGS_Widget_AssetList(this); or auto *_assetList = new TGS_Widget_AssetList(this); Now it works.. i will update my initial post here