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. QGraphicsView::scale not working
QtWS25 Last Chance

QGraphicsView::scale not working

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 113 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.
  • D Offline
    D Offline
    Dadi
    wrote on last edited by
    #1

    Hi,

    I implemented the code below.
    The initial GUI is correct but when I later call to ‘m_pView->scale’ then it is not working, the scale is not changing and nothing happens.
    Any idea what I did wrong?

    class AppMainWnd : public QMainWindow
    {
        QGraphicsScene* m_pScene;
        QGraphicsView* m_pView;
    }
    
    AppMainWnd::AppMainWnd()
    {
        // ...    
        m_pView = new QGraphicsView(this);
        m_pScene = new QGraphicsScene(this);
    
        m_pView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        m_pView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    
        m_pView->setScene(m_pScene);
        ui->verticalLayout->setParent(m_pView); // verticalLayout is of type QVBoxLayout*
        setCentralWidget(m_pView);
    
        QWidget* pMainDisplay = CreateMainDisplay();
    
        m_pView->setViewport(pMainDisplay);
        ui->verticalLayout->setAlignment(Qt::AlignCenter);
        ui->verticalLayout->addWidget(pMainDisplay);
        // ...    
    }
    
    void AppMainWnd::ScaleUI(double dFactor)
    {
        m_pView->scale(dFactor, dFactor); // This does NOT work
    }
    
    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