Ntawm cov ntsiab lus ntawm tus neeg siv interface qhov rai daim, xaiv lossis cov ntaub ntawv nkag teb chaw yog qhov tseem ceeb. Kev ua ntawm cov teeb tsa feem ntau yuav tsum tau ua nrawm nrawm. Yog li ntawd, cov neeg tsim tawm xav tau txais cov ntaub ntawv ntawm kev hloov pauv ntawm lub qhov rais. Hauv cov xwm txheej sib txawv, thaum nyeem cov nqi hauv daim teb, koj yuav tsum xav txog cov ntaub ntawv tshwj xeeb thiab qhov cuam tshuam ntawm cov qauv ntawv.
Cov Lus Qhia
Kauj ruam 1
Thaum txhim kho cov ntawv thov nrog Qt programming cov tsev qiv ntawv, cov ntaub ntawv qhov rai feem ntau yog tsim los ntawm cov widgets (QWidget chav kawm) lossis cov lus qhib (QDialog). Cov ntsiab lus rau kev xaiv lossis cov ntaub ntawv nkag yog ntxiv rau cov khoom ntawm cov chav kawm tshwj xeeb thiab pom rau ntawm cov txheej txheem lossis lub thawv.
Kauj ruam 2
Siv QComboBox chav kawm ua haujlwm nrog daim ntawv teev tseg hauv qab. Nws qhov chaw ua haujlwm pom tau tuaj yeem ua haujlwm rau cov ntaub ntawv nkag los lossis xauv. Yog tias tus neeg siv khoom muaj peev xwm nkag mus rau tus nqi hauv lub tshav pob, ces koj tuaj yeem tau txais nws los ntawm kev xa mus rau cov npe khoom. Piv txwv li cov cai: QComboBox m_comb; QString txiaj ntsig; qhov tshwm sim = m_comb.currentText (); Ntawm no, m_comb kwv siv tus txheej txheemTeTe () rov qab tus nqi tam sim no ntawm daim teb saum toj kawg nkaus, thiab nws tuaj yeem yog nkag mus lossis xaiv hauv qhov poob qis. sau. Txoj hlua sib txawv tshwm sim muaj cov nqi los ntawm kev ua haujlwm pom tau ntawm kev sib tua.
Kauj ruam 3
Txawm li cas los xij, hom ntaus nkag rau cov ntaub ntawv tseem tuaj yeem yog lej. Txhawm rau hloov cov hlua tus nqi rau hom uas yuav tsum tau ua, ua ib qho ntawm cov haujlwm hauv qab no: ob chav resD = result.toDouble (); ntab resF = result.toFloat (); rau cov menyuam resI = result.toInt (); Ntawm no, cov txiaj ntsig tom teb yuav muab khaws cia rau hauv cov resD kuj sib txawv thiab, tab sis twb nyob hauv ob zaug, hauv resF - tus nqi ntab, thiab hauv resI - ib qho txiaj ntsig zoo.
Kauj ruam 4
Thaum siv QLineEdit ib kab ntawv xov xwm kab ntawv los ua cov ntaub ntawv nkag teb chaws, nkag cov ntaub ntawv koj xav tau nrog kev nkag mus hauv qab no: txiaj ntsig = m_edit.text (). Ntawm no, m_edit khoom, siv cov ntawv () muaj nuj nqi, rov cov hlua tus nqi nkag los ntawm tus neeg siv rau hauv lub tshav pob.
Kauj ruam 5
A QListBox caij tuaj yeem ua cov haujlwm zoo sib xws hauv lub qhov rai, nkag mus rau cov ntaub ntawv nkag rau cov khoom no tseem zoo ib yam li cov kev ua dhau los: m_list.currentText ().
Kauj Ruam 6
Thaum nkag mus rau txhua qhov piv txwv ntawm cov chav kawm tau piav qhia, koj yuav tsum muaj cov cai tsim nyog siv, txij li hu rau cov txheej txheem ntiag tug thiab cov khoom siv tsis yooj yim los ntawm cov haujlwm thib peb. Cov kev txiav txim siab tau txais cov nyiaj hauv daim teb muaj qhov chaw qhib.