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. [CLOSED] How to create a resizable QLabel, the label should be resizable through mouse
Forum Updated to NodeBB v4.3 + New Features

[CLOSED] How to create a resizable QLabel, the label should be resizable through mouse

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 5.5k 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.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #1

    The code below puts a sizegrip onto the Qlabel but if i try to resize the label, the mainwindow gets resized instead.

    @void aViewer::on_actionCrop_triggered()
    {
    label= new QLabel(this->ui->graphicsView);
    sizeGrip= new QSizeGrip(this->label);
    label->setSizePolicy( QSizePolicy::Ignored,QSizePolicy::Ignored);
    label->setScaledContents(true);
    label->setFrameStyle(3);
    label->setFixedSize(500, 600);
    label->setMinimumSize(10,10);
    label->setStyleSheet("background-color: rgba(0, 0, 0, 40%)");
    label->setAlignment(Qt::AlignCenter);
    label->show();

    }@

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      That's what the documentation of QSizeGrip also states:
      [quote]
      Put this widget anywhere in a widget tree and the user can use it to resize the top-level window or any widget with the Qt::SubWindow flag set. [/quote]

      You could try to see what happens if you set the Qt::SubWindow flag on your label, but I have no idea if that will start behaving funny...

      1 Reply Last reply
      0
      • A Offline
        A Offline
        adnan
        wrote on last edited by
        #3

        I figured out the right way. I created a new class and inherited QLabel, and added QSizegrip and eveything is working fine, but QSizegrip appears at top left pos instead of right bottom, and thats causing some problem in updating co-ordinates . Is it possible to make QSizeGrip appear at bottom right. I searched a lot in the Doc, but couldn't find any function.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Without you showing us your code, it's hard to point out your mistake...

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            We're continuing this discussion in "this":/forums/viewthread/16199 topic.

            This topic is closed.

            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