Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.1k Posts
  • Simple Line Series Plot not Filling the Centeral Widget?

    Solved
    3
    0 Votes
    3 Posts
    321 Views
    X
    @JoeCFD said in Simple Line Series Plot not Filling the Centeral Widget?: @xpress_embedo said in Simple Line Series Plot not Filling the Centeral Widget?: chartView can you try to set size policy of frame to ? setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); you may set the same thing to chartView Thanks @JoeCFD for your suggestion. Unfortunately it didn't worked, I added the following lines of code. ui->frame->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); chartView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); Later, I did the following changes and now the plot is okay. chartView->setMinimumSize( ui->frame->size() ); For me this is working, thanks for your support, and let me know if you or someone else has some suggestions for me.
  • How to save the widgets load using UiLoader?

    Unsolved
    2
    0 Votes
    2 Posts
    190 Views
    JonBJ
    @Kattia C++ being a compiled language you cannot do this, you cannot create variables at runtime, depending on what is in a file. (Python could, but not C++.) To get variables at runtime that is why you run uic on the .ui file at build time. Which produces a ui_...h file defining the class for ui with individually named variables for each widget. No more findChild<>() calls. So why are you loading the .ui file via UiLoader::load() dynamically at runtime instead of letting it get processed via uic at compile-time?
  • QMediaRecorder - How to access encoded data

    Unsolved
    1
    0 Votes
    1 Posts
    144 Views
    No one has replied
  • QWidget don't change color theme on macOS under specific circumstance

    Unsolved
    3
    0 Votes
    3 Posts
    204 Views
    S
    @SGaist There're another 2 necessary factors beside stylesheet: QScrollArea & QGridLayout. And another observation: go through it: print widget and window palette's rgb, delay printing to 3s later, and switch appearance; you will find that widget palette's RGB hasn't changed, but window palette's has.
  • 0 Votes
    2 Posts
    439 Views
    Christian EhrlicherC
    @Txai said in Possible virus threat on \Qt\6.5.0\mingw_64\bin \Qt63DRender.debug: Suggestion? Report to your antivirus tool and/or update your signatures. Don't know what Qt can do against a false positive.
  • Qt build file not being updated

    Unsolved
    6
    1 Votes
    6 Posts
    994 Views
    mzimmersM
    I notice you're not using a shadow build -- I'd encourage you to start doing so. Also, on Windows, you might get this error if an instance of the application is already running (or hasn't fully shut down). Somewhere in Creator there's an option to ensure that a running program is quit before a new build/run is attempted.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    12 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • htons

    Unsolved htons function
    3
    0 Votes
    3 Posts
    258 Views
    M
    @syrine https://doc.qt.io/qt-6/qtendian.html
  • How to sort item names in treeview alphabetically ignorent of the case?

    Unsolved
    15
    0 Votes
    15 Posts
    1k Views
    M
    Here is the code change that fixed the crash: void RegistryItemDelegate::initStyleOption(QStyleOptionViewItem *inOption, const QModelIndex &inIndex) const { QStyledItemDelegate::initStyleOption(inOption, inIndex); //const Node *node = mModel->node(inIndex); const Node* node = nullptr; //code change start QModelIndex sourceIndex = inIndex; auto proxyModel = dynamic_cast<const QAbstractProxyModel*>(sourceIndex.model()); //We map the index back to its source as many times as needed. //We expect to do it once for now but that may change in the future. while (proxyModel) { sourceIndex = proxyModel->mapToSource(sourceIndex); proxyModel = dynamic_cast<const QAbstractProxyModel*>(sourceIndex.model()); } auto regModel = dynamic_cast<const RegistryItemModel*>(sourceIndex.model()) ; if (regModel) node = regModel->node(sourceIndex); //code change end if(node == NULL) return; if(!node->isDefault()) inOption->palette.setColor(QPalette::Text, mModifiedColor); if(node->nodeType() == eRegDir && inOption->version == 4) { ((QStyleOptionViewItemV4*)inOption)->features |= QStyleOptionViewItemV2::HasDecoration; ((QStyleOptionViewItemV4*)inOption)->icon = mFolderIcon; } }
  • Good books on Qt

    Unsolved
    4
    0 Votes
    4 Posts
    655 Views
    PerdrixP
    @SGaist I did - on the basis on that I bought a copy of Hands-On High Performance Programming with Qt 5, and by comparison with the ones I mentioned, it is frankly quite poor. Which is why I asked for recommendations for books that were up to the same standard as the two I mentioned. D.
  • GPL and .ui file

    Solved licensing gpl
    2
    0 Votes
    2 Posts
    393 Views
    SGaistS
    Hi, You can add: <author> SPDX-FileCopyrightText: Copyright (c) year name_of_copyright_holder email_of_copyright_holder SPDX-License-Identifier: GPL-3.0-or-later </author> Note that this is not specific to GPL. Whatever license you use, you shall make it known. There are several possible ways to do it. I would recommend following the SPDX format. It's simple to manage and you can use the reuse tool to help you ensure you have all what is needed in your software sources.
  • How much does Qt last release internally and externally use smart pointers?

    Solved
    11
    1 Votes
    11 Posts
    1k Views
    Chris KawaC
    @zonman As @mpergand said MainWindow and Ui::MainWindow are two different classes. Ui::MainWindow is a simple "container" class for the widgets set up in the designer. An instance of that class is needed to access them easily. It's not a QObject derived class and does not participate in the parent/child relations. That being said there's no restrictions on how to use that class. Qt wizard uses pointer approach, but if you're allergic to new/delete you can use a smart pointer, so you don't need to delete it explicitly: class MainWindow : public QMainWindow { ... std::unique_ptr<Ui::MainWindow> ui; }; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(std::make_unique<Ui::MainWindow>()) { ui->setupUi(this); ... or you can use it as a direct member: class MainWindow : public QMainWindow { ... Ui::MainWindow ui; }; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); ... although not nice thing about that is you need to include the generated header ui_mainwindow.h in MainWindow header. I wouldn't recommend it, but it's an option. The Ui::MainWindow is just a bag of pointers, so If you do all your setup in the constructor and don't need to access the widgets through the ui variable later on you can even use it entirely locally in the constructor: class MainWindow : public QMainWindow { ... // no ui member at all }; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { Ui::MainWindow().setupUi(this); ...
  • why below simple program get crash ?

    Solved
    11
    0 Votes
    11 Posts
    893 Views
    Q
    @Chris-Kawa @Christian-Ehrlicher @JonB @SGaist Thanks for explain the reason in depth.
  • No Documentation available Error : #include "./ui_widget.h"

    Unsolved
    3
    0 Votes
    3 Posts
    238 Views
    SGaistS
    Hi and welcome to devnet, This is a generated file so unless you are building in your sources (wrong thing to do, don't do it) the file is not in the current folder. Remove the "./" from the include line.
  • How to remove holes / inside parts from a QPainterPath?

    Unsolved
    3
    0 Votes
    3 Posts
    349 Views
    S
    @JoeCFD Its not about the visible representation. I need the Path for further processing.
  • "simple terminal " QT example - repost.

    Unsolved
    1
    0 Votes
    1 Posts
    93 Views
    No one has replied
  • QAbstractTableModel DisplayRole stop working

    Solved
    3
    0 Votes
    3 Posts
    391 Views
    L
    After some searching on Google I understood that when overriding the QHash<int, QByteArray> CRowModel::roleNames() const it declares a new hash table, and it overrides the QAbstractItemModel hash table. your @JonB solution is the way to keep QAbstractItemModel with all the QT roles.
  • Are global objects a good idea?

    Solved
    9
    0 Votes
    9 Posts
    881 Views
    A
    @Leon Then my answer is: They are usually not a good idea, but there are valid exceptions.
  • spinbox up/down buttons not hidding correctly

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    Z
    @JonB yes, I am really sorry, did not see this part of answer . I tested this variant, it works on qt5 and qt6 with deafult styles