[Qt-interest] drawing a QWidget onto another, and positioning it

David Boosalis david.boosalis at gmail.com
Thu Sep 10 02:52:44 CEST 2009


No doubt you that you could do this with a QGroupBox, but why not just
create your own groupbox, say something like:

class MyGroupBox: public QWidget
{
  Q_OBJECT
  public:
  MyGroupBox(QWidget *parent = 0);
 signals:
   void closeMe(bool);
private:
  QToolButton *closeB;
  QLabel      *titleB;
  QWidget     *containerW;
  QPushButton *button1;
   .
   .
  QPushButton *buttonn
};

then create your own layouts and own signals to hide/show

On Wed, Sep 9, 2009 at 12:18 PM, Oszkar Ambrus<oszkar.ambrus at deri.org> wrote:
> Hi,
>
> I searched the archives, and couldn't find a relevant answer to my question.
>
> The problem is this: I want to have a close (X) button for the
> groupboxes in my app,
> so they can be removed during runtime.
>
> Can this be achieved? Can I put a buttonn on the top-right corner,
> without it affecting the proper layout of the QGroupBox, where it's
> composing elements are placed?
>
> Thanks a lot,
> Oszkar
>
> --
> Oszkár Ambrus
>
> "Whoever believes in the Son [Jesus Christ] has eternal life"
> (John 3:36)
>
> Masters Student, Digital Enterprise Research Institute, NUIG
> [http://www.deri.ie]
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>




More information about the Qt-interest-old mailing list