In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you how to achieve multi-form creation with Cpicket + Qt TabWidget, which is easy to understand and well-organized. I hope it can help you to solve your doubts. Here, let me lead you to study and learn how to achieve multi-form creation with Cpicket + Qt TabWidget.
Paging is usually accompanied in the development of form applications. TabWidget components combined with custom Dialog components can achieve a complex multi-form paging structure, which is also a common form layout scheme for ERP and other software.
First of all, to achieve a simple structure with only TabWidget paging, the following form layout, the blank part of the layout is a TabWidget component, below is a button, when the user clicks the button, automatically add the form to the TabWidget component.
The page association code is shown below, which automatically adds a form and sets the form's Tab to the specified IP address when the user clicks on_pushButton_clicked ().
T-> setTabIcon (cur,QIcon (": / image/1.ico"); ui- > tabWidget- > setCurrentIndex (cur); ui- > tabWidget- > setVisible (true);} / / execute void MainWindow::on_tabWidget_tabCloseRequested (int index) {if (indextabWidget- > widget (index); aForm- > close ()) when Tab is closed; void MainWindow::on_tabWidget_currentChanged (int index) {Q_UNUSED (index) is disabled by default on pages without Tab Bool en=ui- > tabWidget- > count () > 0; ui- > tabWidget- > setVisible (en);} each sub-form needs to dynamically obtain the parent form pointer to operate on itself according to the pointer. The sub-form code is as follows. # include "formdoc.h" # include "ui_formdoc.h" # include "mainwindow.h" # include # include FormDoc::FormDoc (QWidget * parent): QWidget (parent), ui (new Ui::FormDoc) {ui- > setupUi (this) QVBoxLayout * Layout = new QVBoxLayout (); Layout- > setContentsMargins; Layout- > setSpacing (2); this- > setLayout (Layout); MainWindow* parWind = (MainWindow*) parentWidget (); / / get parent window pointer QString ref = parWind- > GetTableNumber (); / / get selected tag index std::cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.