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. User Expandable QPushButton in Qt application
Forum Updated to NodeBB v4.3 + New Features

User Expandable QPushButton in Qt application

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 955 Views 2 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.
  • S Offline
    S Offline
    Shahina
    wrote on last edited by
    #1

    Hi. I have a QPushbutton in my application. Is there any way to make QPushButton as user selectable and expandable when the user drag the border of the button.

    Thank you.

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

      Hi
      Well, not directly
      But QSizeGrip can be used to make a fast / not so fancy / hack-ish version
      Note, you need to handle deselecting it again and remove the QSizeGrip etc.
      the code is not complete for really using QSizeGrip.

      For a more full version using sizing object , you can peek at this
      http://www.davidwdrell.net/wordpress/?page_id=46
      It can work for normal widgets too with only slight modification.

      Disclaimer.  Just for fun code. Ugly , incomplete and hackish.
      #include <QSizeGrip>
      #include <QGridLayout>
      ...
       QWidget *the_widget_you_scale=ui->pushButton;
          /// BIG FAT NOTE: PushButtons used fixed height so it wont scale in that direction unless u disable it.
          the_widget_you_scale->setWindowFlags(Qt::SubWindow);
          QSizeGrip * sizeGrip = new QSizeGrip(this);
          QGridLayout * layout = new QGridLayout(the_widget_you_scale);
          layout->addWidget(sizeGrip, 0,0,1,1,Qt::AlignBottom | Qt::AlignRight);
      

      alt text

      1 Reply Last reply
      2
      • S Offline
        S Offline
        Shahina
        wrote on last edited by
        #3

        @mrjj : Thanks for the reply. It works fine.

        mrjjM 1 Reply Last reply
        1
        • S Shahina

          @mrjj : Thanks for the reply. It works fine.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Shahina
          super. the code need a bit more of tweaking but it can work ok.
          I used a message filter to check FocusIn and FocusOut events and added the
          Widget into the "sizer" or removed it from it.

          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