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



  • 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();
    
    
    

  • Lifetime Qt Champion

    Hi,

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



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


  • Qt Champions 2016

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



  • @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?


  • Qt Champions 2016

    @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?



  • @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.


  • Qt Champions 2016


  • Lifetime Qt Champion

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

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



  • @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


  • Lifetime Qt Champion

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



  • @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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.