【问题标题】:Where do i change the label on clicking a button QT单击按钮 QT 我在哪里更改标签
【发布时间】:2017-05-22 10:32:25
【问题描述】:

我为一个项目制作了一个 GUI,它有多种形式,我不知道如何连接它们......问题是这些形式之间的导航不是线性的。

用户在第一页(单选按钮)上的选择决定了下一个表单是什么,我使用 if 语句开发了一个基本算法,但我不知道导航操作。

这是 if 语句

 void InputChoice::on_commandLinkButton_clicked()
{
if (ui->radioButton->isChecked()){
     //Go to state vector input;
}
if (ui->radioButton_2->isChecked()){
   //Go to orbital element input
 }

if (ui->radioButton_3->isChecked()){
   //Go to TLE input
 }

所以我想知道

1- 我们用来将表单链接在一起的语法和/或主体。 2-我怎样才能把它放在一个条件语句中。 3-我在某个地方读到使用命令链接按钮是一个不错的选择

非常感谢:))

【问题讨论】:

  • 我正在寻找每个 if 语句下面用灰色注释写的语句的语法
  • 希望this能帮到你。
  • 如果您正在创建类似向导的界面,您是否考虑过使用 QWizard 框架?

标签: forms qt user-interface navigation


【解决方案1】:
    void InputChoice::on_commandLinkButton_clicked() {

    if (ui->radioButton->isChecked()){

     //Go to state vector input;
    vectorInput = new VectorInput(); // show the form
    vectorInput->exec(); // Don't let anything else happen until choice is made on form

    //or you could also just use show(); but the user can do other things while    form is showing
    vectorInput = new VectorInput();// show the form
    vectorInput->show();

    }
    else if (ui->radioButton_2->isChecked()){
    //Go to orbital element input
    //Same as above
    }

    else if (ui->radioButton_3->isChecked()){
    //Go to TLE input`enter code here`
    //same as above
   }

    else{
          //Do something.
        }


   //Should be something like this. If not, can you elaborate a little more             or where can I see the code?

【讨论】:

  • 非常感谢您的帮助:)) 我找到了一种方法来通过制作“对话框”而不是“小部件”来实现它。但是您如何将表单作为向量处理,QT 自己知道 vectorInput 是表单吗?我的意思是,我们没有在上面声明任何东西。再次感谢:))
  • 您应该在 .h 文件中创建了一个私有成员。像 VectorInput *vectorInput;我假设这是某种形式的表格,因为您称它为表格。
猜你喜欢
  • 1970-01-01
  • 2019-12-03
  • 1970-01-01
  • 1970-01-01
  • 2014-07-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-08
相关资源
最近更新 更多