Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsView sizeIncrement



  • I hope you can help me. I couldn't resize the QGraphicsView incremental 20.
    main.cpp
    #include <QApplication>
    #include <QGraphicsView>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    QGraphicsView *view = new QGraphicsView();
    view->setSizeIncrement(20, 20);
    view->show();
    return a.exec();
    }

    I tried to create a View class and inherit from QGraphicsView, for function overloading
    void View::resizeEvent(QResizeEvent event)
    I was thinking of doing it so
    this->resize(20
    std::round(this->width()/20), 20*std::round(this->height()/20));
    BUT I can't do anything.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What OS are you running ?

    Did you notice the warning in the sizeIncrement property documentation ?



  • I use Ubuntu 16.04. Yes, I watched the documentation. I'm interested in how you can implement similar functionality as sizeIncrement yourself, or something like that.


  • Lifetime Qt Champion

    You'll have to check that with the Window Manager used by your Linux distribution.


Log in to reply