Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 458.1k Posts
  • How to change the size of the item clicked on in a Q3DScatter?

    Unsolved
    1
    0 Votes
    1 Posts
    183 Views
    No one has replied
  • How to use Qt with Visual Studio 2017?

    Unsolved
    15
    0 Votes
    15 Posts
    81k Views
    Chris KawaC
    @JackBerman said in How to use Qt with Visual Studio 2017?: During its installation, administrator rights are required, if they are not present, the installation is successful, but the binding may not be complete. This is manifested in this way, xxxx.ui should turn into ui_xxxx.h during compilation, but the corresponding utility does not work and an error occurs. The uic tool that processes .ui files is part of Qt library, which is configured after the extension is already installed, so I don't see how running VS as an administrator could change anything. There's no binding at that point because there's nothing to bind yet. If you're having issues with the extension could you start a new thread?
  • create tablet application and avoid rotation using qtwidget

    Unsolved
    7
    0 Votes
    7 Posts
    501 Views
    jsulmJ
    @SherifOmran Like explained here? https://doc.qt.io/qt-5/ios-platform-notes.html
  • Creating a QGraphicsTextItem that "follows" a QGraphicsItem

    Solved
    2
    0 Votes
    2 Posts
    148 Views
    Christian EhrlicherC
    See https://doc-snapshots.qt.io/qt5-dev/qgraphicsitem.html#details : "Items can contain other items, and also be contained by other items. All items can have a parent item and a list of children. Unless the item has no parent, its position is in parent coordinates (i.e., the parent's local coordinates). Parent items propagate both their position and their transformation to all children." So make one the parent of the other.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    56 Views
    No one has replied
  • missing path to "include"

    Unsolved
    4
    0 Votes
    4 Posts
    510 Views
    Chris KawaC
    Why moving the header file to local folder ? Sorry, I didn't say you should move anything. I wrongly assumed this was a file of your project. If it's not then that's fine. You don't have to move anything. Is Qt allergic to standard ways? What do you mean by that? The only Qt part in this process is usage of qmake and all it does is pass whatever you give it to the compiler. Can you be more specific what is non-standard here and what standard do you mean? There must be something else I am missing which is causing this Sorry, I'm lost. Which is causing what? If you include one file from the other you have to pass either full or relative path between them. If you want to use just a file name in include you have to pass an include path for that file directly to the compiler (which is done via INCLUDEPATH in qmake). There's nothing Qt specific about this. This is how C++ compilers work.
  • QTreeWidgetItem: Modifying separation between item columns

    Solved
    3
    0 Votes
    3 Posts
    1k Views
    AlveinA
    @mrjj Thanks for your reply. Wow, that sounds complex. I'm basically a newbie in Qt (and for practical purposes, in C++ as well). I don't feel skilled enough to do that. But I found a workaround in the exact things I didn't want to do. I could not find a way to format part of the text in a column. Tried HTML/Style sheets, but the available tags and properties are not enough for me. So I "packed" two labels in a widget and put that inside each each item widget in a tree with one single column. Works marvels but looks redundant and amateurish. Anyway, this is the code I'm using now: void STEdWindow::createXMLTreeView(QTreeWidget *trwTreeView, QTreeWidgetItem *trwParent, QDomNode domChild, QString sElementCSS, QString sTextCSS) { QTreeWidgetItem *trwChild; QLabel *lblName; QLabel *lblValue; QHBoxLayout *layChild; QWidget *wgtChild; while(!domChild.isNull()) { if(QDomDocument::NodeType::ElementNode==domChild.nodeType()) { if(trwParent==nullptr) { trwChild=new QTreeWidgetItem(trwTreeView); trwTreeView->setHeaderHidden(true); } else { trwChild=new QTreeWidgetItem(trwParent); trwParent->addChild(trwChild); trwParent->setExpanded(true); } lblName=new QLabel(trwTreeView); lblValue=new QLabel(trwTreeView); layChild=new QHBoxLayout(trwTreeView); wgtChild=new QWidget(trwTreeView); lblName->setText(domChild.nodeName()); lblName->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); lblName->setStyleSheet(sElementCSS); lblValue->setSizePolicy(QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Fixed); lblValue->setStyleSheet(sTextCSS); layChild->addWidget(lblName); layChild->addSpacing(DEF_TREE_NODE_SPACING); layChild->addWidget(lblValue); layChild->addStretch(); layChild->setContentsMargins(DEF_TREE_NODE_SPACING, DEF_TREE_NODE_SPACING, DEF_TREE_NODE_SPACING, DEF_TREE_NODE_SPACING); wgtChild->setLayout(layChild); trwTreeView->setItemWidget(trwChild,0,wgtChild); this->createXMLTreeView(trwTreeView, trwChild,domChild.firstChild(), sElementCSS, sTextCSS); } else if(QDomDocument::NodeType::TextNode==domChild.nodeType()) { lblValue=qobject_cast<QLabel *>(trwTreeView->itemWidget(trwParent,0)->layout()->itemAt(2)->widget()); lblValue->setText(domChild.nodeValue().trimmed()); } domChild=domChild.nextSibling(); } } Used like this: QDomDocument domDoc; // Set domDoc's Content to any valid XML QTreeWidget *trwTreeView=new QTreeWidget(this); this->createXMLTreeView(trwTreeView, nullptr, domDoc.documentElement(), "padding: 10px; border: 1px solid; border-radius: 10px", "font-style: italic"); And with DEF_TREE_NODE_SPACING 10, I get this: [image: 4671c55b-605a-43b5-9ade-386569908da7.png] BTW, that long line, the cast...I think it's an abomination haha...Is there a correct way to do that? I.e., getting the 2nd label in the parent item widget.
  • qmake & mocing problem

    Unsolved
    14
    0 Votes
    14 Posts
    1k Views
    V
    @Christian-Ehrlicher I solved the problem with workaround that using rsync the folders... I gonna lookup later cause'f project waits...
  • Turn entire app in grayscale

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    Chris KawaC
    @sandro4912 Well you've got the mInsideRender = false; line in the wrong place, it should be either under call to paintEvent or under call to render. But even then Qt seems to warn about recursive paint event. I guess technically we do want recursion here, but just one time. So anyway - this way won't work. Sorry for turning you in the wrong direction.
  • I can't understand the new syntax of connect

    Solved
    7
    0 Votes
    7 Posts
    780 Views
    JKSHJ
    @Mr-Pang said in I can't understand the new syntax of connect: I think doc.qt.io may update the doc about QSpinBox since my syntax is copied from there. The latest version of the documentation (Qt 5.13.1) uses QOverload: https://doc.qt.io/qt-5/qspinbox.html Anyway, has your original question been answered? Do you understand the new connect syntax now?
  • QT ScrollBars doesn't appear with scrollAreaWidgetContents

    Moved Unsolved qt scrollarea
    5
    0 Votes
    5 Posts
    2k Views
    L
    I know this is an old thread but I just want to chip in to this. I got this exact problem trying to put anything into a QScrollBar in designer and they just don't work because of this stupid dummy "scrollAreaWidgetContents" that was auto created. It cannot be modified or deleted. The only workaround I found is to do everything in the main cpp, creating the image label and adding it to the QScrollArea object, skipping the scrollAreaWidgetContents, which completely took away the convenience of using the designer.
  • Can a top level item have a checkbox?

    Solved
    4
    0 Votes
    4 Posts
    400 Views
    CKurduC
    @SRaD You are welcome. Good luck.
  • QLabel->setScaledContents() does not work

    Unsolved
    3
    0 Votes
    3 Posts
    559 Views
    Kent-DorfmanK
    My guess is that it is because the OP is trying to modify the pixmap in a label managed from within a dialog. The dialog is probably setting some constraints that override the setScaledContent() call.
  • Moving object back to parent thread

    Unsolved
    5
    0 Votes
    5 Posts
    928 Views
    R
    Thanks for helping, SGaist! At the end I changed connect(device_thread, &QThread::finished, device_thread, &QObject::deleteLater); to connect(device_thread, &QThread::finished, this, [this, dev_id](){ this->DeleteActiveDevice(dev_id); }); and added slot void SerialDeviceManager::DeleteActiveDevice(const int dev_id) { delete active_devices[dev_id].second; active_devices.remove(dev_id); // At this point serial port connection will be with no thread affinity devices[dev_id]->moveToThread(QThread::currentThread()); }
  • QList.removeAt(int index) removes wrong item

    Unsolved
    4
    0 Votes
    4 Posts
    281 Views
    JonBJ
    @vlada said in QList.removeAt(int index) removes wrong item: I don't understand it... You were indeed going crazy :)
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • QT_DEBUG and #include <QDebug>

    Unsolved
    7
    0 Votes
    7 Posts
    3k Views
    ODБOïO
    @SGaist true! i fixed also my bad
  • 'No rule to make target' after upgrading Qt on mac

    Solved
    2
    0 Votes
    2 Posts
    1k Views
    J.HilkJ
    @kitfox delete the whole Build directory by hand and than rebuild the project Simply calling clean and rebuild is not enough after an xcode/osx update
  • Crash when using QKeySequence as global constant

    Unsolved
    2
    0 Votes
    2 Posts
    215 Views
    Christian EhrlicherC
    @Kerndog73 said in Crash when using QKeySequence as global constant: Why does it crash and how do I get around this? It crashes because QKeySequence (like most other gui classes) need a QGuiApplication instance to work properly. Simply don't create any global static at all.
  • 0 Votes
    4 Posts
    705 Views
    C
    I eventually became overly frustrated and I just re-installed the whole Qt package. It appears to be working fine now. Thanks so much for your assistance.