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. QToolBar initial size is strange

QToolBar initial size is strange

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 231 Views 2 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    This code:

        QToolBar t(&w);
        QIcon dragRect("C:/Users/amonra/Documents/GitHub/DSS/DeepSkyStacker/Buttons/ButtonSelect_Up.bmp");
        t.setOrientation(Qt::Vertical);
        t.addAction(dragRect, "", &editor, "dragButtonPressed");
        //t.setFixedSize(50, 50);
        t.setIconSize(QSize(48, 48));
        w.setToolBar(&t);
        w.show();
    

    creates the toolbar with a very strange size (100 wide, 30 high) as reported by this code:

        if (m_pToolBar)
        {
            qreal width(m_pToolBar->width());
            qreal height(m_pToolBar->height());
            QPoint point(sz.width() - width, sz.height() - height);
            qDebug() << "width" << width << "height" << height;
            m_pToolBar->move(point);
        }
    

    in the widget's resizeEvent(code) on the first invocation. The result is that the ToolBar is incorrectly positioned within the widget.

    If I then resize the widget the ToolBar size is reported as a much more sane value of 59 wide 58 high (is height off by 1?) and it is then positioned correctly

    1 Reply Last reply
    0
    • PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote on last edited by
      #2

      Bumpety bump

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

        Hi,

        Please show some patience and wait at least 24 hours before bumping your own thread. This is a voluntary driven forum and people might not live in the same time zone as you.

        Which version of Qt ?
        On which OS ?
        If Linux, what distribution ? Desktop environment ?

        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

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved