本文整理汇总了C++中QLabel::show方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::show方法的具体用法?C++ QLabel::show怎么用?C++ QLabel::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateLayout
void TKAction::updateLayout(QWidget* base)
{
QLabel* textLabel = (QLabel*)base->child("text");
QLabel* pixLabel = (QLabel*)base->child("pixmap");
QWidget* w = (QWidget*)base->child("widget");
if (!textLabel || !pixLabel || !w)
return;
if (!text().isEmpty() && m_imode != TK::IconOnly ) {
textLabel->setText(text());
textLabel->show();
} else
textLabel->hide();
QPixmap pix;
if (hasIcon())
pix = iconSet(KIcon::Small).pixmap();
if (!icon().isEmpty())
pix = BarIcon(icon());
if (!pix.isNull() && m_imode != TK::TextOnly) {
pixLabel->setPixmap(pix);
pixLabel->show();
} else
pixLabel->hide();
base->setFixedWidth( w->sizeHint().width() +
(textLabel->isVisible() ? textLabel->sizeHint().width():0) +
(pixLabel->isVisible() ? pixLabel->sizeHint().width():0) );
}
示例2: layout
void ProgView::layout() {
int maxHeight = 0;
for (int i = 0; i < channelBar.size(); i++) {
int y = 0;
QLabel *chan = channelBar.at(i);
int x = getX(i);
int width = getKey(CHANNEL_WIDTH).toInt();
int height = chan->heightForWidth(width);
if (height > maxHeight) {
maxHeight = height;
}
chan->setGeometry(x, y, width, height);
chan->show();
//qDebug() << "x: " << x << "y: " << y;
//qDebug() << chan->text();
}
CHANNELBAR_HEIGHT.def = maxHeight;
setKey(CHANNELBAR_HEIGHT);
for (int i = 0; i < timeLine.size(); i++) {
int x = 0;
QLabel *lab = timeLine.at(i);
int y = getY(timeLineDate.value(lab));
lab->setGeometry(x, y, lab->sizeHint().width(),
lab->sizeHint().height());
lab->show();
//qDebug() << "x: " << x << "y: " << y;
//qDebug() << lab->text();
}
}
示例3: QFrame
//! [0]
DragWidget::DragWidget(QWidget *parent)
: QFrame(parent)
{
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
#else
setMinimumSize(200, 200);
#endif
setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
setAcceptDrops(true);
QLabel *boatIcon = new QLabel(this);
boatIcon->setPixmap(QPixmap(":/images/boat.png"));
boatIcon->move(10, 10);
boatIcon->show();
boatIcon->setAttribute(Qt::WA_DeleteOnClose);
QLabel *carIcon = new QLabel(this);
carIcon->setPixmap(QPixmap(":/images/car.png"));
carIcon->move(100, 10);
carIcon->show();
carIcon->setAttribute(Qt::WA_DeleteOnClose);
QLabel *houseIcon = new QLabel(this);
houseIcon->setPixmap(QPixmap(":/images/house.png"));
houseIcon->move(10, 80);
houseIcon->show();
houseIcon->setAttribute(Qt::WA_DeleteOnClose);
}
示例4: QFrame
//! [0]
DragWidget::DragWidget(QWidget *parent)
: QFrame(parent)
{
setMinimumSize(200, 200);
setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
setAcceptDrops(true);
QLabel *boatIcon = new QLabel(this);
boatIcon->setPixmap(QPixmap(":/images/boat.png"));
boatIcon->move(20, 20);
boatIcon->show();
boatIcon->setAttribute(Qt::WA_DeleteOnClose);
QLabel *carIcon = new QLabel(this);
carIcon->setPixmap(QPixmap(":/images/car.png"));
carIcon->move(120, 20);
carIcon->show();
carIcon->setAttribute(Qt::WA_DeleteOnClose);
QLabel *houseIcon = new QLabel(this);
houseIcon->setPixmap(QPixmap(":/images/house.png"));
houseIcon->move(20, 120);
houseIcon->show();
houseIcon->setAttribute(Qt::WA_DeleteOnClose);
}
示例5: setupNewHostDialog
void kiptablesgenerator::setupNewHostDialog()
{
newHostDialog = new KDialogBase(this, 0, true, i18n("Add Host"), KDialogBase::Ok | KDialogBase::Cancel);
QFrame *dialogArea = new QFrame(newHostDialog);
QGridLayout *layout = new QGridLayout(dialogArea, 5, 2);
QLabel *intro = new QLabel(i18n(
"<p>Here you can tell netfilter to allow all connections from a given host regardless of other rules, "
"or block all connections from a given host regardless of other rules.</p>"
"<p>You can specify a host either by IP address or MAC address.</p>"), dialogArea);
intro->show();
layout->addMultiCellWidget(intro, 0, 0, 0, 1);
QButtonGroup *whitelistOrBlacklist = new QButtonGroup(dialogArea);
whitelistOrBlacklist->hide();
QRadioButton *whitelist = new QRadioButton(i18n("&Allow"), dialogArea);
whitelist->setChecked(true);
whitelist->show();
layout->addWidget(whitelist, 1, 0);
namedWidgets["newHost_allow"] = whitelist;
whitelistOrBlacklist->insert(whitelist);
QRadioButton *blacklist = new QRadioButton(i18n("&Block"), dialogArea);
blacklist->setChecked(false);
blacklist->show();
layout->addWidget(blacklist, 1, 1);
whitelistOrBlacklist->insert(blacklist);
QButtonGroup *ipOrMAC = new QButtonGroup(dialogArea);
ipOrMAC->hide();
QRadioButton *useIP = new QRadioButton(i18n("&Use IP"), dialogArea);
useIP->setChecked(true);
useIP->show();
layout->addWidget(useIP, 2, 0);
namedWidgets["newHost_useIP"] = useIP;
ipOrMAC->insert(useIP);
QRadioButton *useMAC = new QRadioButton(i18n("U&se MAC"), dialogArea);
useMAC->show();
layout->addWidget(useMAC, 2, 1);
ipOrMAC->insert(useMAC);
QLabel *hostLabel = new QLabel(i18n("Host:"), dialogArea);
hostLabel->show();
layout->addMultiCellWidget(hostLabel, 3, 3, 0, 1);
KLineEdit *host = new KLineEdit(dialogArea);
host->show();
namedWidgets["newHost_address"] = host;
layout->addMultiCellWidget(host, 4, 4, 0, 1);
connect(newHostDialog, SIGNAL(okClicked()), this, SLOT(slotAddHost()));
dialogArea->show();
newHostDialog->setMainWidget(dialogArea);
}
示例6: setupNewForwardDialog
void kiptablesgenerator::setupNewForwardDialog()
{
newForwardDialog = new KDialogBase(this, 0, true, i18n("Add Forward"), KDialogBase::Ok | KDialogBase::Cancel);
QFrame *dialogArea = new QFrame(newForwardDialog);
QGridLayout *layout = new QGridLayout(dialogArea, 4, 2);
QLabel *intro = new QLabel(i18n(
"<p><i>Advanced users only</i></p>"
"<p>Here you can tell netfilter to forward connections to given ports to another address/port.</p>"
"<p>This is using netfilter's DNAT functionality - incoming redirects go in the prerouting chain,"
"outgoing redirects go in the output chain.</p>"
"<p>The destination should be of the from destination.computer.ip.address:destinationPort</p>"), dialogArea);
intro->show();
layout->addMultiCellWidget(intro, 0, 0, 0, 1);
QButtonGroup *direction = new QButtonGroup(dialogArea);
direction->hide();
QRadioButton *incoming = new QRadioButton(i18n("&Incoming"), dialogArea);
incoming->setChecked(true);
incoming->show();
layout->addWidget(incoming, 1, 0);
namedWidgets["forward_incoming"] = incoming;
direction->insert(incoming);
QRadioButton *outgoing = new QRadioButton(i18n("&Outgoing"), dialogArea);
outgoing->show();
layout->addWidget(outgoing, 1, 1);
direction->insert(outgoing);
QLabel *label = new QLabel(i18n("Port:"), dialogArea);
label->show();
layout->addWidget(label, 2, 0);
KLineEdit *port = new KLineEdit(dialogArea);
port->show();
layout->addWidget(port, 2, 1);
namedWidgets["forward_port"] = port;
label = new QLabel(i18n("Destination:"), dialogArea);
label->show();
layout->addWidget(label, 3, 0);
KLineEdit *destination = new KLineEdit(dialogArea);
destination->show();
layout->addWidget(destination, 3, 1);
namedWidgets["forward_destination"] = destination;
connect(newForwardDialog, SIGNAL(okClicked()), this, SLOT(slotAddForward()));
dialogArea->show();
newForwardDialog->setMainWidget(dialogArea);
}
示例7: preview
void ImageConverter::preview()
{
QLabel l;
l.setPixmap(QPixmap::fromImage(originalImage()));
l.show();
qApp->exec();
l.setPixmap(QPixmap::fromImage(resultImage()));
l.show();
qApp->exec();
}
示例8: main
int main( int argc, char** argv )
{
QApplication app( argc, argv );
InputManager::instance()->initialize();
InputDevice* keyboard = InputManager::instance()->device( "qt_keyboard" );
if( !keyboard )
qFatal( "No keyboard found!" );
InputParameter* parameter = keyboard->parameter( Qt::Key_Return );
if( !parameter )
qFatal( "No return key found!" );
QLabel label;
QObject::connect( parameter, &InputParameter::buttonStateChanged, [&]() {
label.setText( parameter->buttonState() == InputParameter::ButtonPressed ? "Return Pressed" : "Return Released" );
} );
label.show();
app.exec();
}
示例9: main
int main(int argc, char *argv[])
{
QApplication a{argc, argv};
QLabel label;
QPicture pic;
pic.setBoundingRect({-100, -100, 200, 200});
QPainter p(&pic);
const QPointF pt;
p.drawEllipse(pt, 3, 3);
p.setFont({"Helvetica", 40});
p.setPen({128, 0, 0, 128});
drawText(p, pt, Qt::AlignBottom, "_LB");
drawText(p, pt, Qt::AlignVCenter, "_LC");
drawText(p, pt, Qt::AlignTop, "_LT");
p.setPen({0, 128, 0, 128});
drawText(p, pt, Qt::AlignBottom | Qt::AlignHCenter, "MB");
drawText(p, pt, Qt::AlignVCenter | Qt::AlignHCenter, "MC");
drawText(p, pt, Qt::AlignTop | Qt::AlignHCenter, "MT");
p.setPen({0, 0, 128, 128});
drawText(p, pt, Qt::AlignBottom | Qt::AlignRight, "RB_");
drawText(p, pt, Qt::AlignVCenter | Qt::AlignRight, "RC_");
drawText(p, pt, Qt::AlignTop | Qt::AlignRight, "RT_");
p.end();
label.setPicture(pic);
label.show();
return a.exec();
}
示例10: showEvent
void MagpieFileImportPopup::showEvent(QShowEvent *)
{
if (m_info == 0)
return;
int frameCount = m_info->getFrameCount();
m_fromField->setRange(1, frameCount);
m_fromField->setValue(1);
m_toField->setRange(1, frameCount);
m_toField->setValue(frameCount);
int i;
QList<QString> actsIdentifier = m_info->getActsIdentifier();
for (i = 0; i < m_actFields.size(); i++) {
IntLineEdit *field = m_actFields.at(i).second;
QLabel *label = m_actFields.at(i).first;
if (i >= actsIdentifier.size()) {
field->hide();
label->hide();
continue;
}
QString act = actsIdentifier.at(i);
field->setProperty("act", QVariant(act));
field->show();
label->setText(act);
label->show();
}
QString oldLevelPath = m_levelField->getPath();
TFilePath oldFilePath(oldLevelPath.toStdWString());
TFilePath perntDir = oldFilePath.getParentDir();
m_levelField->setPath(QString::fromStdWString(perntDir.getWideString()));
}
示例11: ctkDICOMImageTest1
int ctkDICOMImageTest1( int argc, char * argv [] )
{
QApplication app(argc, argv);
if (argc <= 1)
{
std::cerr << "Warning, no dicom file given. Test stops" << std::endl;
std::cerr << "Usage: qctkDICOMImageTest1 <dicom file>" << std::endl;
return EXIT_FAILURE;
}
DicomImage dcmtkImage(argv[1]);
ctkDICOMImage ctkImage(&dcmtkImage);
QLabel qtImage;
QPixmap pixmap = QPixmap::fromImage(ctkImage.frame(0),Qt::AvoidDither);
if (pixmap.isNull())
{
std::cerr << "Failed to convert QImage to QPixmap" ;
return EXIT_FAILURE;
}
qtImage.setPixmap(pixmap);
qtImage.show();
if (argc > 2 && QString(argv[2]) == "-I")
{
return app.exec();
}
return EXIT_SUCCESS;
}
示例12: loadNewImage
void MainWindow::loadNewImage(QString pathName)
{
if(sa == NULL)
{return;}
FileCentre *fc = FileCentre::GetInstance();
QString path = fc->GetRecordPath();
QDir dir(path);
QStringList filter;
filter<<"*.png"<<"*.jpg"<<"*.bmp";
dir.setNameFilters(filter);
int iNum = dir.count();
if(iNum < 1)
{return;}
//MyLabel *lb = new MyLabel(mLW, pathName);
QLabel *lb = WidgetFactory::GetLabel(mLW, pathName);
lb->setGeometry(QRect(10, (iNum-1)*190, 180, 180));
lb->setPixmap(pathName);
lb->setScaledContents(true);
lb->show();
/*
sa->setWidget(mLW);
sa->setGeometry(0,0, 210, 820);
mLW->setGeometry(0,0,190,190*(iNum+1));
mLW->show();
sa->show();
*/
mLW->setGeometry(0,0,190,190*(iNum+1));
}
示例13: addRuntimeWidgets
void radeon_profile::addRuntimeWidgets() {
// add button for manual refresh glx info, connectors, mod params
QPushButton *refreshBtn = new QPushButton();
refreshBtn->setIcon(QIcon(":/icon/symbols/refresh.png"));
ui->tabs_systemInfo->setCornerWidget(refreshBtn);
refreshBtn->setIconSize(QSize(20,20));
refreshBtn->show();
connect(refreshBtn,SIGNAL(clicked()),this,SLOT(refreshBtnClicked()));
ui->label_version->setText(tr("version %n", NULL, appVersion));
// version label
QLabel *l = new QLabel("v. " +QString().setNum(appVersion),this);
QFont f;
f.setStretch(QFont::Unstretched);
f.setWeight(QFont::Bold);
f.setPointSize(8);
l->setFont(f);
ui->mainTabs->setCornerWidget(l,Qt::BottomRightCorner);
l->show();
// button on exec pages
QPushButton *btnBackProfiles = new QPushButton();
btnBackProfiles->setText(tr("Back to profiles"));
ui->tabs_execOutputs->setCornerWidget(btnBackProfiles);
btnBackProfiles->show();
connect(btnBackProfiles,SIGNAL(clicked()),this,SLOT(btnBackToProfilesClicked()));
// set pwm buttons in group
QButtonGroup *pwmGroup = new QButtonGroup();
pwmGroup->addButton(ui->btn_pwmAuto);
pwmGroup->addButton(ui->btn_pwmFixed);
pwmGroup->addButton(ui->btn_pwmProfile);
}
示例14: keyPressEvent
void MainWindow::keyPressEvent(QKeyEvent* event)
{
const int codigoTecla = event->key();
if( codigoTecla == Qt::Key_Up)
{
player->up = true;
}
if(codigoTecla == Qt::Key_Down)
{
player->down = true;
}
if(codigoTecla == Qt::Key_Left)
{
player->left = true;
}
if(codigoTecla == Qt::Key_Right)
{
player->right = true;
}
if(codigoTecla == Qt::Key_Space)
{
QLabel* tempLabel = new QLabel();
tempLabel->setParent(this);
tempLabel->show();
playerBullets->append(newPlayerBeam(270,player->position->x + (player->width/2),player->position->y-20,tempLabel,1));
}
}
示例15: playMovie
void tst_QMovie::playMovie()
{
QFETCH(QString, fileName);
QFETCH(int, frameCount);
QMovie movie(fileName);
QCOMPARE(movie.state(), QMovie::NotRunning);
movie.setSpeed(1000);
movie.start();
QCOMPARE(movie.state(), QMovie::Running);
movie.setPaused(true);
QCOMPARE(movie.state(), QMovie::Paused);
movie.start();
QCOMPARE(movie.state(), QMovie::Running);
movie.stop();
QCOMPARE(movie.state(), QMovie::NotRunning);
movie.jumpToFrame(0);
QCOMPARE(movie.state(), QMovie::NotRunning);
movie.start();
QCOMPARE(movie.state(), QMovie::Running);
connect(&movie, SIGNAL(finished()), this, SLOT(exitLoopSlot()));
QLabel label;
label.setMovie(&movie);
label.show();
QTestEventLoop::instance().enterLoop(20);
QVERIFY2(!QTestEventLoop::instance().timeout(),
"Timed out while waiting for finished() signal");
QCOMPARE(movie.state(), QMovie::NotRunning);
QCOMPARE(movie.frameCount(), frameCount);
}