Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Solved]creating tabs
QtWS25 Last Chance

[Solved]creating tabs

Scheduled Pinned Locked Moved Mobile and Embedded
48 Posts 5 Posters 22.9k 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.
  • A Offline
    A Offline
    alfah
    wrote on last edited by
    #41

    ahhh, , its not workin on the simulator or the device!!

    it is '/'. And i have corrected it. But still it does not work. Does image size gotta do anything with it??
    ive used 16x16. its almost 900 byte

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #42

      you can test if it's available from the resource editor using a dialog in Qt Designer and set the icon from there.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alfah
        wrote on last edited by
        #43

        Ive pulled in a tabWidget in the Designer. But i can only find iconsize property not the simple icon property with which you can set.

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #44

          no you have to use code to add it to a tab.

          But you could use a QLabel just for testing if the icon is reachable through the resource editor.

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alfah
            wrote on last edited by
            #45

            it worked in the new project, both in the device as well as the simulator.
            @
            ui->tabWidget->setTabIcon(0,QIcon(":/images/clock.png"));
            @

            I think i know why it doesn work on my application.
            @
            tabWidget = new QTabWidget;
            tabWidget->setStyleSheet("QTabWidget::tab-bar{left:0px; width:350px; }\n"
            "QTabBar::tab{height:40px; width:95px; color:red; font:9pt; }\n");
            tabWidget->setTabIcon(0,QIcon(":/images/clock.png"));

            pCalender = new QWidget;
            pHistory = new QWidget;
            pStatistics= new QWidget;

            connect(tabWidget,SIGNAL(currentChanged(int)),this,SLOT(onSelectTab(int)));
            tabWidget->addTab(pCalender,tr("Calender"));
            tabWidget->addTab(pHistory,tr("History"));
            tabWidget->addTab(pStatistics,tr("Statistics"));
            tabWidget->setTabIcon(0,QIcon(":/images/clock.png"));
            @

            EDIT : solved :D

            1 Reply Last reply
            0
            • EddyE Offline
              EddyE Offline
              Eddy
              wrote on last edited by
              #46

              bq. it worked in the new project, both in the device as well as the simulator.

              so you know a good approach to solve issues yourself. Sometimes a project can grow bigger and bigger. If you make a small test project like you did you can easily narrow down to the problem. Now you know for sure that the code is right.

              bq. EDIT: na i don think so, cuz widgets are placed inside the tabs not on those heading.

              To be sure just comment out the lines you suspect. This one is for you ;)

              Qt Certified Specialist
              www.edalsolutions.be

              1 Reply Last reply
              0
              • A Offline
                A Offline
                alfah
                wrote on last edited by
                #47

                ok all advises noticed and acknowledged :)

                I have solved it too,

                I jus needed to place the same code after the addTab function(), :) How dumb of me! How else would it put an icon if the tab not added :D :D

                1 Reply Last reply
                0
                • EddyE Offline
                  EddyE Offline
                  Eddy
                  wrote on last edited by
                  #48

                  Glad you solved it! You even start helping out others.

                  Keep up the good work!

                  Qt Certified Specialist
                  www.edalsolutions.be

                  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