Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.3k Topics 455.7k Posts
  • Using Community instead of Evaluation

    Unsolved
    1
    0 Votes
    1 Posts
    99 Views
    No one has replied
  • Is it a difference where I compile a code?

    Unsolved compile
    19
    0 Votes
    19 Posts
    2k Views
    Pablo J. RoginaP
    @TomNow99 I guess you may want to take a look at this library: lwext4 Although "The main goal of the lwext4 project is to provide ext2/3/4 filesystem for microcontrollers" documentation also mentions compilation for Windows. And then take a look at project ext4-browser which relies on that library to provide "a file-archiver like utility which can create, read and modify ext2/3/4 disks and disk images on Windows and Mac OS systems." although the GUI is written using wxWidgets framework. So getting back to my suggestion, I guess you might combine lwext4 library and the ext2read GUI to achieve your goal...
  • Wrong OpenGL viewport of widget inside QDockWidget

    Solved
    7
    0 Votes
    7 Posts
    556 Views
    Jaime02J
    I found the problem: There was missing a QOpenGLWidget::resizeEvent(event); statement at resizeEvent.
  • Help with deprecated code

    Solved
    6
    0 Votes
    6 Posts
    917 Views
    L
    OK, I see. I converted to QString which seems to fix the error.
  • grabWindow only grabs desktop background in macOS Catalina

    Solved
    3
    0 Votes
    3 Posts
    580 Views
    freddy311082F
    Awesome @jsulm... it works !!! Thank you very much !!!
  • Need help to create simple model for QTreeModelView

    Solved
    37
    0 Votes
    37 Posts
    4k Views
    Please_Help_me_DP
    Now when I have some MyModel I would like to write MyProxyModel which inherited by QAbstractProxyModel (I need to understand how they work that is why I don't want to use QSortFilterProxyModel for now). QAbstractProxyModel inherits QAbstractItemModel so as I understand I must implelement at least the following pure virtual methods from these both abstract models: int QAbstractItemModel::columnCount(const QModelIndex &parent = QModelIndex()) const QVariant QAbstractItemModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const QModelIndex QAbstractItemModel::index(int row, int column, const QModelIndex &parent = QModelIndex()) const QModelIndex QAbstractItemModel::parent(const QModelIndex &index) const int QAbstractItemModel::rowCount(const QModelIndex &parent = QModelIndex()) const QModelIndex QAbstractProxyModel::mapFromSource(const QModelIndex &sourceIndex) const QModelIndex QAbstractProxyModel::mapToSource(const QModelIndex &proxyIndex) const Ok, I don't want to use any kind of a sorting I just want to wrap MyModel to MyProxyModel. In proxy model I just declare the same methods that my source model has and invoke these methods: h5proxymodel.h #ifndef H5PROXYMODEL_H #define H5PROXYMODEL_H #include <QAbstractProxyModel> #include <QSortFilterProxyModel> #include "h5model.h" class H5ProxyModel : public QAbstractProxyModel { Q_OBJECT public: explicit H5ProxyModel(QObject *parent = nullptr); ~H5ProxyModel(); QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override; QModelIndex mapToSource(const QModelIndex &proxyIndex) const override; void setSourceModel(QAbstractItemModel *sourceModel) override; QAbstractItemModel* getSourceModel(); QModelIndex index(int row, int column, const QModelIndex &parent) const override; QModelIndex parent(const QModelIndex &index) const override; int rowCount(const QModelIndex &parent) const override; int columnCount(const QModelIndex &parent) const override; QVariant data(const QModelIndex &index, int role) const override; bool setData(const QModelIndex &index, const QVariant &value, int role) override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex()) override; bool removeRows(int position, int rows, const QModelIndex &parent = QModelIndex()) override; bool hasChildren(const QModelIndex &parent = QModelIndex()) const override; void expand(const QModelIndex &parent); void collapse(const QModelIndex &parent); Qt::ItemFlags flags(const QModelIndex &index) const override; private: QAbstractItemModel* sourceModel; }; #endif // H5PROXYMODEL_H h5proxymodel.cpp #include "h5proxymodel.h" H5ProxyModel::H5ProxyModel(QObject *parent) : QAbstractProxyModel(parent) { } H5ProxyModel::~H5ProxyModel() { delete sourceModel; } QModelIndex H5ProxyModel::mapFromSource(const QModelIndex &sourceIndex) const{ if (!sourceIndex.isValid()) return QModelIndex(); return sourceIndex; } QModelIndex H5ProxyModel::mapToSource(const QModelIndex &proxyIndex) const { if (!proxyIndex.isValid()) return QModelIndex(); return proxyIndex; } void H5ProxyModel::setSourceModel(QAbstractItemModel *sourceModel){ this->sourceModel = sourceModel; } QAbstractItemModel* H5ProxyModel::getSourceModel(){ return this->sourceModel; } QModelIndex H5ProxyModel::index(int row, int column, const QModelIndex &parent) const{ return this->sourceModel->index(row, column, parent); } QModelIndex H5ProxyModel::parent(const QModelIndex &index) const{ return this->sourceModel->parent(index); } int H5ProxyModel::rowCount(const QModelIndex &parent) const{ return this->sourceModel->rowCount(parent); } int H5ProxyModel::columnCount(const QModelIndex &parent) const{ return this->sourceModel->columnCount(parent); } QVariant H5ProxyModel::data(const QModelIndex &index, int role) const{ return sourceModel->data(index, role); } bool H5ProxyModel::setData(const QModelIndex &index, const QVariant &value, int role){ return sourceModel->setData(index, value, role); } QVariant H5ProxyModel::headerData(int section, Qt::Orientation orientation, int role) const{ return sourceModel->headerData(section, orientation, role); } bool H5ProxyModel::insertRows(int position, int rows, const QModelIndex &parent){ return sourceModel->insertRows(position, rows, parent); } bool H5ProxyModel::removeRows(int position, int rows, const QModelIndex &parent){ return sourceModel->removeRows(position, rows, parent); } bool H5ProxyModel::hasChildren(const QModelIndex &parent) const{ return sourceModel->hasChildren(parent); } void H5ProxyModel::expand(const QModelIndex &parent){ static_cast<H5Model*>(sourceModel)->expand(parent); } void H5ProxyModel::collapse(const QModelIndex &parent){ static_cast<H5Model*>(sourceModel)->collapse(parent); } Qt::ItemFlags H5ProxyModel::flags(const QModelIndex &index) const{ return sourceModel->flags(index); } As you can see all that my proxy does is it redirects commands to source model. But all I see is header in tree view instead of a items (the right picture I see if I set source model to a tree view): [image: b30fd52f-a2f9-4466-83b8-a66cd89e5ede.png] Why my logic doesn't work?
  • How does the QTimer stop function work?

    Unsolved
    1
    0 Votes
    1 Posts
    102 Views
    No one has replied
  • QComboBox, height ?

    Solved
    2
    0 Votes
    2 Posts
    184 Views
    VRoninV
    https://doc.qt.io/qt-5/qstyle.html#sizeFromContents
  • How to use/include the QtNetwork Module

    Unsolved
    8
    0 Votes
    8 Posts
    2k Views
    VRoninV
    Last time I used the VS Tools (that was with VS 2013) it required to start a project from scratch, not sure if they introduced a "convert to qt project" feature since
  • 1 Votes
    1 Posts
    507 Views
    No one has replied
  • Debugging QComboBox delegate freezes System

    Unsolved
    1
    0 Votes
    1 Posts
    98 Views
    No one has replied
  • Qt label image display always has different size from original image

    Unsolved
    2
    0 Votes
    2 Posts
    576 Views
    VRoninV
    Try setting the scaledContents property of QLabel to true
  • Using Caffe Model with C++ QT Application

    Unsolved
    3
    0 Votes
    3 Posts
    323 Views
    I
    Thanks for helping. I am trying the github link. Actually the reason behind using MTCNN is to detect profile faces also on thermal images. I want to try whether MTCNN can do it or not?
  • This topic is deleted!

    Unsolved
    3
    0 Votes
    3 Posts
    42 Views
  • How To Show Text In TaskBar Of Win7(or newer)?

    Unsolved
    9
    0 Votes
    9 Posts
    738 Views
    qazaq408Q
    @mrjj Thank you very much
  • Qt VS Tools Always building stuff for Release build

    Solved
    5
    0 Votes
    5 Posts
    573 Views
    jsulmJ
    @Perdrix Please mark thread as solved
  • Custom DelayButton background not changing

    Solved qproxystyle qpushbutton
    6
    0 Votes
    6 Posts
    1k Views
    M
    I finally made it: in order to operate color, I have to overrule standard behavior set full set of styles using setStyleSheet handle events manage flow And I gave up to use it at the end: a lot of custom code with a doubtful outcome ugly design not clear flow Solution: I use the standard functionality of the standard button. Better explain to the user what "it works and feels the same as all other buttons in Windows"
  • Compile errors because of "new" file

    Unsolved
    2
    0 Votes
    2 Posts
    176 Views
    Christian EhrlicherC
    Don't use that name since it's a system header.
  • QSerialPort::open() returning permission error

    Solved
    14
    0 Votes
    14 Posts
    4k Views
    mzimmersM
    I found it -- totally my fault. I was opening ports in another thread, and not maintaining them well. Bad design, bad implementation. Thanks to everyone who looked.
  • qt 5.15 - getting the debug dlls

    Solved
    2
    0 Votes
    2 Posts
    548 Views
    B
    I remember having seen posts of similar questions. And the answer in them is mingw now has no difference in debug and release dlls. The Qt5Core.dll.debug is not a debug version of dll, but the symbol file for debugging.