当前位置:   article > 正文

Qt状态栏_addpermanentwidget

addpermanentwidget

QStatusBar

  1. QStatusBar* stBar = statusBar();
  2. QLabel* lb1 = new QLabel("标签1"); //
  3. lb1->setAlignment(Qt::AlignLeft); //左对齐
  4. QLabel* lb2 = new QLabel("标签2");
  5. QLineEdit* edit = new QLineEdit("edit");
  6. QPushButton* btnOpen = new QPushButton("打开");
  7. stBar->addWidget(lb1);
  8. stBar->addWidget(lb2);
  9. stBar->addPermanentWidget(edit);
  10. stBar->addPermanentWidget(btnOpen);
  11. //stBar->showMessage("显示");
  12. lb1->setText("显示1");
  13. edit->setText("空内容");

(1)addPermanentWidget:在状态栏的右半部分添加组件。It is is located at the far right of the status bar

(2)addWidget:在状态栏的左半部分添加组件。The widget is located to the far left of the first permanent widget and may be obscured by temporary messages.

(3)showMessage:Hides the normal status indications and displays the given message for the specified number of milli-seconds

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/943192
推荐阅读
相关标签
  

闽ICP备14008679号