-1

I have simple tab with label and checkbox. I want to add slider, but slider is not showing. Method setGeometry wrong there?

 RollsTab::RollsTab(QWidget *parent)
     : QWidget(parent)
 {
     QFont font("Times", 11);

     label1 = new QLabel(rus("11111"), this);
        label1->setFont(font);
        label1->setGeometry(20, 25, 160, 20);
     checkBoxRolls = new QCheckBox(rus(""), this);
        checkBoxRolls->setChecked(stateRR);
        checkBoxRolls->setGeometry(180, 25, 55, 22);

     sliderA = new QSlider(Qt::Horizontal);
          sliderA->setRange(0, 99);
          sliderA->setValue(0);
          sliderA->setGeometry(20, 50, 55, 22);
 }
Deng Won
  • 11
  • 5

1 Answers1

0

It is good practice to initiate slider with a parent, like:

sliderA = new QSlider(Qt::Horizontal, this);

and add it to a layout (if you have one) through addWidget function http://qtdocs.narod.ru/4.1.0/doc/html/qgridlayout.html#addWidget

sliderA needs to be a QSlider* defined in header file

Shf
  • 3,463
  • 2
  • 26
  • 42