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. Set Width of a QWidget

Set Width of a QWidget

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

    Hi, Currently I returned to develop the app that I started two years ago. I am finishing the infrastructure but the UI has some issue that I want to fix.

    I have been reading a lot these days but I am a little bit lost.

    I am tryint to adjust te size of a tabWidget using the size of a Qtablewidget that I have inside one tab, but always the size goes to (0.0), 'm trying something like that:

    void MainWindow::on_tabWidget_tabBarClicked(int index)
    {
    QSize s;
    switch (index) {
    case 2:
    s = ui->rmTableWidget->size();
    ui->tabWidget->setMinimumWidth(s.width());
    ui->tabWidget->adjustSize();
    s = ui->tabWidget->size();
    break;
    default:
    break;
    }
    }

    Could someone tell me how I could set that size.

    Thank you very much in advanced.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Use layouts, then UI will automatically adjust sizes of all elements.

      (Z(:^

      1 Reply Last reply
      2

      • Login

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