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. QSizeGrip is not visibile inside the QRubberBand when compiled on OSX.
QtWS25 Last Chance

QSizeGrip is not visibile inside the QRubberBand when compiled on OSX.

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 3 Posters 2.7k Views
  • 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.
  • CarLoowwwwC Offline
    CarLoowwwwC Offline
    CarLoowwww
    wrote on last edited by CarLoowwww
    #1

    QSizeGrip button is not shown when i show the QRubberBand.I tried to search on google about this issue. But i cant find one. If anyone knows a solution of this issue, can someone tell me about it? This issue is happening only in OSX, while the other platform are able to show the QSizeGrip.

    Here is the Code:

          setWindowFlags(Qt::SubWindow);
    
          QHBoxLayout* layout = new QHBoxLayout(this);
          layout->setContentsMargins(0, 0, 0, 0);
    
          QSizeGrip* grip1 = new QSizeGrip(this);
          QSizeGrip* grip2 = new QSizeGrip(this);
    
          layout->addWidget(grip1, 0, Qt::AlignLeft | Qt::AlignTop);
          layout->addWidget(grip2, 0, Qt::AlignRight | Qt::AlignBottom);
    
          this->resize(100,100);
    
    
          rubberband = new QRubberBand(QRubberBand::Rectangle, this);
    
          QGraphicsColorizeEffect *ee = new QGraphicsColorizeEffect(rubberband);
          ee->setColor(QColor(0,0,0,0));
          rubberband->setGraphicsEffect(ee);
    
          rubberband->show();
    
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I may be wrong but IIRC, on OS X there's no visible size grip thus QSizeGrip follows that.

      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
      • CarLoowwwwC Offline
        CarLoowwwwC Offline
        CarLoowwww
        wrote on last edited by
        #3

        So if you were right, is there any alternative to risize the QRubberband?

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

          so besides not showing it, it cannot resize ? Nothing happens if u drag where QSizeGrip should have been drawn?

          CarLoowwwwC 1 Reply Last reply
          0
          • mrjjM mrjj

            so besides not showing it, it cannot resize ? Nothing happens if u drag where QSizeGrip should have been drawn?

            CarLoowwwwC Offline
            CarLoowwwwC Offline
            CarLoowwww
            wrote on last edited by
            #5

            @mrjj yes, draging the QRubberBand is the only thing that i can do. I cannot resize it since the QSizeGrip is not shown. Do you have any idea or alternative to this issue?

            mrjjM 1 Reply Last reply
            0
            • CarLoowwwwC CarLoowwww

              @mrjj yes, draging the QRubberBand is the only thing that i can do. I cannot resize it since the QSizeGrip is not shown. Do you have any idea or alternative to this issue?

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

              @CarLoowwww
              So the QSizeGrip you create , are disabled by Osx??
              I thought it was merely a visual thing and they are drawn differently but you say they are completely removed?

              CarLoowwwwC 1 Reply Last reply
              0
              • mrjjM mrjj

                @CarLoowwww
                So the QSizeGrip you create , are disabled by Osx??
                I thought it was merely a visual thing and they are drawn differently but you say they are completely removed?

                CarLoowwwwC Offline
                CarLoowwwwC Offline
                CarLoowwww
                wrote on last edited by
                #7

                @mrjj yes, i took some research about QSizeGrip, and they completely removed it on OSX platform. So im looking on a way to resize the QRubberBand when i drag it on its corner.

                mrjjM 1 Reply Last reply
                0
                • CarLoowwwwC CarLoowwww

                  @mrjj yes, i took some research about QSizeGrip, and they completely removed it on OSX platform. So im looking on a way to resize the QRubberBand when i drag it on its corner.

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

                  @CarLoowwww
                  Well you can maybe reuse some code from here
                  https://gist.github.com/IMAN4K/b2f251bfd2043b99e95160026979a8a6

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

                    Can you provide a complete sample code of your widget using QRubberBand ?

                    That will make it more easy to reproduce your use case.

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

                    CarLoowwwwC 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Can you provide a complete sample code of your widget using QRubberBand ?

                      That will make it more easy to reproduce your use case.

                      CarLoowwwwC Offline
                      CarLoowwwwC Offline
                      CarLoowwww
                      wrote on last edited by CarLoowwww
                      #10

                      @SGaist

                      ok here is the custom class of my QRubberBand.

                      #include <QSizeGrip>
                      #include <QMouseEvent>
                      #include <QHBoxLayout>
                      #include <QGraphicsColorizeEffect>
                      
                      
                      RubberBandCustomized::RubberBandCustomized(QWidget *parent) : QWidget(parent)
                      {
                          //here is buliding rubber band
                            QHBoxLayout* layout = new QHBoxLayout(this);
                            layout->setContentsMargins(0, 0, 0, 0);
                      
                            QSizeGrip* grip1 = new QSizeGrip(this);
                            QSizeGrip* grip2 = new QSizeGrip(this);
                      
                            layout->addWidget(grip1, 0, Qt::AlignLeft | Qt::AlignTop);
                            layout->addWidget(grip2, 0, Qt::AlignRight | Qt::AlignBottom);
                      
                            this->resize(100,100);
                      
                      
                            rubberband = new QRubberBand(QRubberBand::Rectangle, this);
                            
                            QGraphicsColorizeEffect *ee = new QGraphicsColorizeEffect(rubberband);
                            ee->setColor(QColor(0,0,0,0));
                            rubberband->setGraphicsEffect(ee);
                      
                            rubberband->show();
                      }
                      void RubberBandCustomized::resizeEvent(QResizeEvent *e)
                      {
                      
                          rubberband->resize(e->size());
                      
                      }
                      
                      

                      and here is the code where i create my Custom Rubberband.

                      PhotoBoardPlugin_Dialog::PhotoBoardPlugin_Dialog(QWidget *parent) :
                          QDialog(parent),
                          ui(new Ui::PhotoBoardPlugin_Dialog)
                      {
                          ui->setupUi(this);
                      
                          scene = new QGraphicsScene(this);
                          ui->graphicsView->setScene(scene);
                          ui->graphicsView->setStyleSheet( "QGraphicsView { border-style: none; }" );
                          ui->graphicsView->setStyleSheet( "QGraphicsView { background-color: rgb(0,0,0); }" );
                      
                          //setting size to fit scene
                          int scene_w = ui->graphicsView->width();
                          int scene_h = ui->graphicsView->height();
                      
                          sourceImage = QImage(QString("://textureForTest/mardana_330x468.png"));
                          sourceImage = sourceImage.scaled(QSize(scene_w,scene_h),Qt::KeepAspectRatio);
                          m =  QPixmap::fromImage(sourceImage);
                      #ifdef Q_OS_MACX
                          setWindowIcon(QIcon(""));
                          ui->pushButton_2->setDefault(true);
                      #endif
                      
                          int wc = ( scene_w - m.width())/2;
                          int hc = ( scene_h - m.height())/2;
                      
                          pixmap = scene->addPixmap(m);
                          pixmap->setPos(wc,hc);
                          //pixmap->setFlag(QGraphicsItem::ItemIsMovable);  
                      
                          rubberBand = new RubberBandCustomized(ui->graphicsView);
                          rubberBand->move(150, 150);
                      
                          setWindowTitle(tr("Plugin - Photo Board"));
                      
                      }
                      

                      Inside the whitebox there should be 2 QSizeGrip, but since it is not shown i am not able to resize the white box which is the QRubberBand that uses a QWidget with SubWindow Flag.
                      Image

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

                        Your code can't be compiled, there are missing functions.

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

                        CarLoowwwwC 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Your code can't be compiled, there are missing functions.

                          CarLoowwwwC Offline
                          CarLoowwwwC Offline
                          CarLoowwww
                          wrote on last edited by CarLoowwww
                          #12

                          @SGaist Edited codes. I removed some function, since those function are just to make sure that the rubberband will not be moved beyond the border of the photo.

                          I also tried this sample Link to sample and compile it in two different platform(Using Windows and OSX). The Windows can freely resize the rubberband and working very well. While when i compiled it on OSX the initialization of the position and size of the rubberband are working but it has no resize handle/no interaction.

                          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