Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Moving Class into Widget
Qt 6.11 is out! See what's new in the release blog

Moving Class into Widget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qohelet
    wrote on last edited by
    #1

    Thanks to this Forum I'm really making progress in QT-Developing. :)

    Now I'm facing a problem which is for me kinda difficult to understand. A colleague of mine developed a class which inherits from QWidget. The constructor also. It sets up a new interface but without using the QGroupBox(es) or QVBoxLayout(s) which are seen in most of the Tutorials.

    That's now kinda confusing for me. How am I able to move his interface inside one of these Container/Layout-Objects? None of the method-calls refer to the "parent"-parameter. As I understand it the QWidget is addressed directly always.

    The hpp:
    @class Warehousedisplay : public QWidget {
    Q_OBJECT
    //this and that...
    }@

    The cpp
    @Warehousedisplay::Warehousedisplay(QWidget* parent) : QWidget(parent)
    {
    setBackgroundRole(QPalette::Dark);
    setAutoFillBackground(true);
    //and so on... but no usage of "parent"
    }@

    I've tried already to define a QFrame (because QFrame inherits directly from QWidget) which calls these methods (instead directly) - and afterwards put the QFrame inside a QVBoxLayout. But this didn't work at all as it should have. In fact my QVBoxLayout didn't appear at all, I've just taken the basic-functionality away...

    Also the constructor-inheritance doesn't seem to have an effect at all. The code returns the same result with or without it.

    What is a proper way to move these functionalities?
    Thank you!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you provide an example of that class and how you are using it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qohelet
        wrote on last edited by
        #3

        It's pretty similar to that:

        http://www.qtcentre.org/threads/47276-Plotter-class

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved