Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • connect qaction from menubar to a slot in a different class

    Solved
    8
    0 Votes
    8 Posts
    787 Views
    J.HilkJ
    No problem 😀 Make sure to set the topic to solved, by using the topic tools, thanks!
  • Is Qt is platform dependant or Independant?

    Solved
    4
    0 Votes
    4 Posts
    533 Views
    aha_1980A
    @Ashutosh_Sachdeva so please mark this topic as SOLVED too. Thanks!
  • Android project build error

    Solved
    4
    0 Votes
    4 Posts
    806 Views
    Cobra91151C
    I have fixed the issue, the problem was with wrong project path, also I set ANDROID_HOME and ANDROID_SDK_ROOT environment variables. The issue is resolved.
  • QTcpSocket why SocketTimeoutError is raised ?

    Unsolved
    16
    0 Votes
    16 Posts
    3k Views
    C
    @J-Hilk I tried what you said. But the error is still raised. And the message "Connected!" is displayed. The two lines of code are added just after the connectToHost.
  • QThread events not ocurring as expected

    Solved
    3
    0 Votes
    3 Posts
    232 Views
    D
    Worked. I was looking solution in wrong direction. Thanks for advice!
  • How to implement a simultaneous file editing?

    Solved
    3
    0 Votes
    3 Posts
    294 Views
    K
    Thank you! I'll dig into that asap
  • Problems with signals and slots in separate threads

    Solved
    6
    0 Votes
    6 Posts
    3k Views
    H
    @BjornW Thank you so much for clearing that up with the meta-types, that was indeed the problem! I've been on vacation the past week, so sorry for the delayed answer. The type I was passing was an enum class, which really wasn't necessary. I just changed it to a regular enum and made the signal/slots use int to make use of enums' implicit casting, works like a charm!
  • How to change the size of the item clicked on in a Q3DScatter?

    Unsolved
    1
    0 Votes
    1 Posts
    181 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
    493 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
    144 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
    489 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
    998 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
    752 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
    385 Views
    CKurduC
    @SRaD You are welcome. Good luck.
  • QLabel->setScaledContents() does not work

    Unsolved
    3
    0 Votes
    3 Posts
    546 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.