MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / AddViewers

Method AddViewers

App/Client/ParameterDlgSettings.cpp:98–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void CParameterDlgSettings::AddViewers(const QList<QWidget *> &wViewer)
99{
100 int nWidth = 0;
101 int nHeigth = 0;
102 foreach(auto p, wViewer) {
103 if(!p) continue;
104 nWidth = qMax(nWidth, p->frameSize().width());
105 nHeigth = qMax(nHeigth, p->frameSize().height());
106 }
107 bool bScroll = false;
108 QScreen* pScreen = QApplication::primaryScreen();
109 QSize size = this->size();
110 if(nWidth > size.width() || nHeigth > size.height())
111 bScroll = true;
112 // [connect accepted to slotAccept of widget]
113 foreach(auto p, wViewer)
114 {
115 QString szMsg;
116 QWidget* pView = p;
117 if(bScroll)
118 {
119 QScrollArea* pScroll = new QScrollArea(ui->tabWidget);
120 if(!pScroll) continue;
121 pScroll->setWidget(p);
122 pView = pScroll;
123 }
124 ui->tabWidget->addTab(pView, p->windowIcon(), p->windowTitle());
125 bool check = false;
126 check = connect(this, SIGNAL(accepted()), p, SLOT(slotAccept()));
127 if(!check)
128 {
129 szMsg = "Class '" + QString(p->metaObject()->className())
130 + "' must has slot slotAccept(), please add it. "
131 + "Or the class derived from CParameterUI";
132 qCritical(log) << szMsg;
133 }
134 Q_ASSERT_X(check, "CParameterDlgSettings", szMsg.toStdString().c_str());
135 }
136 // [connect accepted to slotAccept of widget]
137}
138
139void CParameterDlgSettings::on_pbOk_clicked()
140{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected