Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • QT Sdk - practive, can one private object access another one?

    Unsolved source
    4
    0 Votes
    4 Posts
    860 Views
    jsulmJ
    @Dariusz said in QT Sdk - practive, can one private object access another one?: Would it not make sense if a private class can access other widget's private classes? No. Private is there for a reason. Private stuff should not be accesed directly by the outside world. If there is no public API yet for something and it is really needed, then it needs to be added. But this is not a reason to break encapsulating by allowing direct access to private APIs. Also, in C++ you can't access private members/methods from other classes without making these classes friends. Nothing Qt can do about (and it also should not). And as @SGaist pointed out: the PIMPL design pattern is there to prevent ABI from changing if internal implementation changes. Means: if you change something in the private implementation without changing public API, then the user code does not have to be rebuilt. Since you can't restrict access to private APIs to private classes (like what your example shows: widget->getPrivate()) also non-private classes would be able to access those interfaces and (even worse) user code.
  • checkbox Stylesheet Bug

    Unsolved
    1
    0 Votes
    1 Posts
    188 Views
    No one has replied
  • listwidgetitem check box style sheet not working

    Unsolved
    1
    0 Votes
    1 Posts
    207 Views
    No one has replied
  • checkbox indicator size not change

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    I
    @Pl45m4 The same is true of removing the color-applied value. void WToggleMenu::InitListitem() { for (int n = 0; n < 20; n++) { usrCntrListItem* pListItem = new usrCntrListItem(QString("%1").arg(n)); QListWidgetItem* pWidgetItem = new QListWidgetItem(this->ui.listWidget); pWidgetItem->setSizeHint(pListItem->sizeHint()); this->ui.listWidget->addItem(pWidgetItem); this->ui.listWidget->setItemWidget(pWidgetItem, pListItem); } } usrCntrListItem::usrCntrListItem(QString strTitle) { ui.setupUi(this); this->ui.label->setText(strTitle); this->ui.label->setFixedHeight(60); //this->ui.checkBox->setStyleSheet("margin-left:1%; margin-right:1%;"); this->ui.checkBox->setStyleSheet("\ QCheckBox::indicator\ {\ width: 50px;\ height: 50px;\ }"); } [image: febf15f7-abeb-455e-b3f2-ef93c61c580b.gif] The indicator area does not look large on the screen, but the area is large when clicked. It's also checked when you click outside the check box. Is it a bug? I think it's a problem with the set sizehint. Can you check the entire code?
  • how can i use round buttons and put the in a layout without lose their shape

    Unsolved
    5
    0 Votes
    5 Posts
    640 Views
    B
    Your border-radius is set to 20px, that need your buttons to have both their width and height at least 40px to work. It has nothing to do with layouts.
  • This topic is deleted!

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

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Minimum number of Widgets added to a window which have a minimum size

    Unsolved
    15
    0 Votes
    15 Posts
    2k Views
    Swati777999S
    @JKSH said in Minimum number of Widgets added to a window which have a minimum size: @Swati777999 said in Minimum number of Widgets added to a window which have a minimum size: The reason for using QMap is that I've become familiar with it . I've not tried arrays with QVector. A vector is an array. A map is not an array. dTWidgets[ii]->setLayout(flowLayout); Tell us: Which which should this layout belong to? FlowLayout *flowLayout=new FlowLayout(); // Parent Layout Flow Layout Example from Qt documentation I've included flowlayout.h and flowlayout.cpp in the headers and sources of Layout project. [image: 908bff6a-c8f3-45af-92d7-edeb8fe5bad9.PNG] Which widget is your top-level widget? QWidget *mSWidget = new QWidget(this); QVBoxLayout *mSLayout=new QVBoxLayout(mSWidget); mSWidget ->setLayout(mSLayout); actually it's the outer level box to which an inner level layout is added , now I am focussed on the inner level design which should look like [image: 58c07f23-4841-4574-90c3-ef69a54efae9.PNG] To FlowLayout ,these units are added as widgets. I hope that I explained it well.
  • Capitalization issue on some computers

    Solved
    5
    0 Votes
    5 Posts
    304 Views
    JoeCFDJ
    @bheld if it is the case, change to another font to see if the problem is gone.
  • widgets: mini combo-box (popup) draws wrong on windows

    Unsolved
    6
    0 Votes
    6 Posts
    432 Views
    SGaistS
    Then you will likely have to create a subclass and reimplement the showPopup method to adjust the size of the pop on Windows.
  • How can I make a UI like this?

    Solved
    2
    0 Votes
    2 Posts
    158 Views
    SGaistS
    Hi, Yes and yes. Or use Qt Quick.
  • Simple client/server example ?

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    VRoninV
    My experience is that examples included in Qt are misleading for people just learning how it works. I'd suggest you use this example on the wiki instead as first step
  • Equivalent of valgrind, in c ++ and qt for debugging

    Unsolved
    3
    0 Votes
    3 Posts
    351 Views
    Pablo J. RoginaP
    @lincoln I could think of Deleaker Spoiler alert: I haven't used it myself.
  • Equally spaced tables in a layout

    Unsolved
    6
    0 Votes
    6 Posts
    585 Views
    Pl45m4P
    @Swati777999 The order when you create what doesn't matter, as long as you assign it correctly after everything is created. Of course you can't assign the widget to your array without creating it first.
  • QOpenGLWidget bad display with QT_SCREEN_SCALE_FACTORS=1.5

    Unsolved
    2
    0 Votes
    2 Posts
    159 Views
    P
    Disregard this - the bug is in our code which is setting glViewport() to the size of the widget in the paintGl().
  • QUdpSocket and broadcast receiver

    Solved
    10
    0 Votes
    10 Posts
    2k Views
    KroMignonK
    @mrdebug said in QUdpSocket and broadcast receiver: for (int count= 0; count< QNetworkInterface::allAddresses().count(); count++) { if (QNetworkInterface::allAddresses().at(count).protocol()== QAbstractSocket::IPv4Protocol && QNetworkInterface::allAddresses().at(count)!= QHostAddress(QHostAddress::LocalHost)) { QUdpSocket *pQUdpSocket= new QUdpSocket(this); pQUdpSocket->bind(QNetworkInterface::allAddresses().at(count), 3702, QAbstractSocket::DontShareAddress | QAbstractSocket::ReuseAddressHint); pQUdpSocket->joinMulticastGroup(QHostAddress("239.255.255.250")); connect(pQUdpSocket, SIGNAL(readyRead()), this, SLOT(DiscoveringPendingDatagrams())); QVQUdpSockets.append(pQUdpSocket); } } This code don't looks very good to me :( Please avoid multiple calling of QNetworkInterface::allAddresses(). This don't make sense, you always work with a new list instance! I would prefer something like: for(const auto & interface : QNetworkInterface::allAddresses()) { if (interface.protocol() == QAbstractSocket::IPv4Protocol && interface != QHostAddress(QHostAddress::LocalHost)) { auto pQUdpSocket = new QUdpSocket(this); pQUdpSocket->bind(interface, 3702, QAbstractSocket::DontShareAddress | QAbstractSocket::ReuseAddressHint); pQUdpSocket->joinMulticastGroup(QHostAddress("239.255.255.250")); connect(pQUdpSocket, SIGNAL(readyRead()), this, SLOT(DiscoveringPendingDatagrams())); QVQUdpSockets.append(pQUdpSocket); } }
  • Getting the dimensions of a QTableWidget object

    Locked Unsolved
    4
    0 Votes
    4 Posts
    376 Views
    JonBJ
    Since the user is asking the same question and getting the same answers in thread https://forum.qt.io/topic/132497/how-to-get-the-dimensions-of-the-widgets, suggest people don't post further in this thread.
  • How to get the dimensions of the widgets

    Unsolved
    14
    0 Votes
    14 Posts
    2k Views
    JKSHJ
    @Ketan__Patel__0011 said in How to get the dimensions of the widgets: You can try this ui->YourWidget->geometry(); it's Return Your Widget Location And Size; This won't work before the widget is shown.
  • How to stop a thread without signal & slot?

    Unsolved
    2
    0 Votes
    2 Posts
    168 Views
    jsulmJ
    @makopo quit() should work if your thread has an event loop. If not, take a look at https://doc.qt.io/qt-5/qthread.html#isInterruptionRequested and https://doc.qt.io/qt-5/qthread.html#requestInterruption
  • How to distribute custom plugins in cross platform environments

    Unsolved
    9
    0 Votes
    9 Posts
    885 Views
    dporobicD
    @jsulm said in How to distribute custom plugins in cross platform environments: In this case I would not package these plug-ins as rpm/deb packages. A zip archive would be enough and user can then decide where to put the plug-ins. Problem is that it has a dependency, it relays on Tessarect that is installed with it. For windows I will package it in a zip as you said but on Linux it should be installed so the dependency can be resolved. Or is there a way to package it together with the dependency, like AppImage for libs?