Пример #1
0
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
0
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
0
//! [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
0
void LoginDialog::makeInputs(unsigned &row, Client *client, bool bQuick)
{
    if (!bQuick){
        QLabel *pict = new QLabel(this);
        pict->setPixmap(Pict(client->protocol()->description()->icon));
        picts.push_back(pict);
        PLayout->addWidget(pict, row, 0);
        pict->show();
    }
    QLabel *txt = new QLabel(this);
    txt->setText(bQuick ? i18n("Password:"******"Forgot password?"));
        lnkHelp->setUrl(i18n(helpUrl).latin1());
        lnkHelp->show();
        links.push_back(lnkHelp);
    }
    row++;
}
Пример #5
0
//! [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);
}
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);
}
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);
}
Пример #8
0
void ImageConverter::preview()
{

    QLabel l;
    l.setPixmap(QPixmap::fromImage(originalImage()));
    l.show();

    qApp->exec();

    l.setPixmap(QPixmap::fromImage(resultImage()));
    l.show();

    qApp->exec();

}
Пример #9
0
Файл: main.cpp Проект: KDE/gluon
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();
}
Пример #10
0
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();
}
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()));
}
Пример #12
0
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;
}
Пример #13
0
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));
}
Пример #14
0
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);
}
Пример #15
0
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));
        }

}
Пример #16
0
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);
}
Пример #17
0
int main1(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QLabel *label = new QLabel("<h1><i style='color:blue'>Hello</i> <font color='red'>中国</font>!</h1>");
    label->show();
    return a.exec();
}
/* Create a private key for the given accountname/protocol if
 * desired. */
void OtrConnection::create_privkey(const char *accountname, const char *protocol) {
	char fingerprint[45];

	QLabel* l = new QLabel("\n   Please wait, while generating key for " + QString(accountname) + "   \n");
	l->show();
	QCoreApplication::processEvents();
	QCoreApplication::processEvents();

	otrl_privkey_generate(userstate, keysFile.toStdString().c_str(), accountname, protocol);
	QCoreApplication::processEvents();
	l->hide();
	QCoreApplication::processEvents();

	if (otrl_privkey_fingerprint(userstate, fingerprint, accountname, protocol) == NULL) {
		qWarning() << "Failed to generate private key\n";
		exit(1);
	}
	
	QMessageBox* d = new QMessageBox(QMessageBox::Information,
					 "psi-otr",
					 "The fingerprint for " + QString(accountname) + " is\n" + QString(fingerprint),
					 QMessageBox::Ok,
					 NULL,
					 Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
	d->exec();
}		      
Пример #19
0
int main(int argc, char* argv[])
{
	QApplication app(argc, argv);
	QLabel *label = new QLabel("<h2><i>Howdy friendo!</i>""<b><font color=red> Welcome to my header.</font></b></h2>");
	label->show();
	return app.exec();
}
Пример #20
0
void NumberChoiceLive::chooseNumber(int number) {
	//numbers[number]->setText(QString(QChar(prizes[number])));
	QPixmap *prizeImage;
	
	switch(prizes[number]) {
		case 'B':
			if (isVisible()) QSound::play("media/sounds/PrizeBronze.wav");
			prizeImage = prizeBronze;
			break;
		case 'S':
			if (isVisible()) QSound::play("media/sounds/PrizeSilver.wav");
			prizeImage = prizeSilver;
			break;
		case 'G':
			if (isVisible()) QSound::play("media/sounds/PrizeGold.wav");
			prizeImage = prizeGold;
			break;
	}
	QPixmap smallerPrize = prizeImage->scaled(numbers[number]->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
	QLabel *medal = new QLabel(numbers[number]->parentWidget());
	medal->setAttribute(Qt::WA_DeleteOnClose);
	medal->setPixmap(smallerPrize);
	medal->resize(smallerPrize.size()); // Using . rather than -> with smallerPrize because smallerPrize isn't a pointer
	medal->move(numbers[number]->geometry().center() - medal->geometry().center());
	medal->show();
	connect(this, SIGNAL(resetAll(bool)), medal, SLOT(close()));
}
Пример #21
0
int Main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QLabel *label = new QLabel("Hello Qt!");
    label->show();
    return app.exec();
}
 /**
 * @brief GameBoard::game_over
 * Called if there are no hallows left. Tells the user that the game is over. Closes the game.
 */
void GameBoard::game_over()
{
    QLabel* endlabel = new QLabel("You lose! Game over!");
    endlabel->show();
    endlabel->setFixedSize(200,100);
    this->close();
}
/**
  * @brief GameBoard::HarryMeetsDementor
  * @param x Harry's x coordinate.
  * @param y Harry's y coordinate.
  */
 void GameBoard::HarryMeetsDementor(int x, int y)
 {
     //If Harry moves to a position that is the same as a dementor, lose a hallow.
     //This is called in key press event.

     for(size_t i=0;i<number_dementors;i++) {

        int px = Dementor_position[i].rx();
        int py = Dementor_position[i].ry();
        if(x == px && y == py)
       {

         if(hallows_remaining > 1)
         {
         hallows_remaining--;
         hallows[hallows_remaining-1]->clear();
         QLabel* p = new QLabel("The dementor! Lose a hallow!");
         p->show();
         }
        }


     }

     return;
 }
Пример #24
0
void LargeTable::scrollToHeight(int height) {
    auto rowsAndOffset = rowsAndOffsetForHeight(height);
    std::list<LargeTableModel::RowIndex> rows = rowsAndOffset.first;
    int offset = -rowsAndOffset.second;
    // The messages indicated by <rows> should be drawn from the top of the screen
    // Its top position should be <offst> pixels above the top of the screen
    // clear it
    QList<QWidget*> widgets = findChildren<QWidget*>();
    foreach(QWidget *widget, widgets) {
        delete widget;
    }
    for(LargeTableModel::RowIndex ri : rows) {
        unsigned int width = 0;
        LargeTableModel::Row &r = ltm->at(ri);
        for(unsigned int column = 0; column < r.size(); ++column) {
            QLabel *label = new QLabel(QString::fromStdString(r.at(column)), this);
            label->resize(columnWidths[column], heights[ri]);
            label->setAlignment(Qt::AlignTop);
            label->move(width, offset);
            label->show();
            label->setWordWrap(true);
            label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
            width += columnWidths[column];
        }
        offset += heights[ri];
    }
}
Пример #25
0
void rkFrame::showIcon(IconType type)
{
	QStringList iconTypeList = QStringList::split(",", "none,alm,kb,usb,drop,", true);
	QString iconTypeName;
	QString labelName;
	QLabel *label;
	int index = -1;

	for(int i = 0; i < 4; i++) {
		if (iconStat[i] == type) {
			return;
		} else if (iconStat[i] == IconNone) {
			index = i;
		}
	}

	if (index != -1) {
		labelName = "iconLabel" + QString::number(index + 1, 10);
		label = (QLabel *)this->child(labelName, "QLabel", true);
		if (!label) {
			return;
		} 
		iconTypeName = "icon_" + iconTypeList[type] + "_arm.png";
		QPixmap pixmap = QPixmap::fromMimeSource(iconTypeName);
		label->setPixmap(pixmap);
		label->show();
		iconStat[index] = type;
	}
}
Пример #26
0
forwardingPage::forwardingPage(QString text, QString newText, QWidget* parent) : QFrame(parent)
{
    m_newForwardDialog = new newForwardDialog(newText, this);
    connect(m_newForwardDialog, SIGNAL(okClicked()), this, SLOT(slotAdd()));

    QGridLayout *layout = new QGridLayout(this, 4, 2);
    layout->setSpacing(KDialogBase::spacingHint());

    QLabel *label = new QLabel(text, this);
    label->show();
    layout->addMultiCellWidget(label, 0, 0, 0, 1);

    m_forwards = new KListView(this);
    m_forwards->addColumn(i18n("In/Out"));
    m_forwards->addColumn(i18n("Port"));
    m_forwards->addColumn(i18n("Destination"));
    m_forwards->show();
    layout->addMultiCellWidget(m_forwards, 1, 3, 0, 0);
    connect(m_forwards, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()));

    m_add = new KPushButton(i18n("Add Port"), this);
    m_add->show();
    layout->addWidget(m_add, 1, 1);
    connect(m_add, SIGNAL(clicked()), m_newForwardDialog, SLOT(show()));

    m_del = new KPushButton(i18n("Remove Port"), this);
    m_del->show();
    m_del->setEnabled(false);
    layout->addWidget(m_del, 2, 1);
    connect(m_del, SIGNAL(clicked()), this, SLOT(slotDel()));

    layout->setColStretch(0, 1);
}
Пример #27
0
void Window::showErrorMessage(const QString& msg) {
	QLabel* label = new QLabel(this);
	label->setText(QString("<font color='red'>%1</font>").arg(msg));
	label->show();
	layout()->add(label);
	QTimer::singleShot(ERROR_TIMEOUT, label, SLOT(deleteLater()) );
}
Пример #28
0
void crobot::dropEvent(QDropEvent *event)
{
    if (event->mimeData()->hasFormat("application/x-dnditemdata")) {
        QByteArray itemData = event->mimeData()->data("application/x-dnditemdata");
        QDataStream dataStream(&itemData, QIODevice::ReadOnly);

        QPixmap pixmap;
        QPoint offset;
        dataStream >> pixmap >> offset;



        QLabel *newIcon = new QLabel(this);
        newIcon->setPixmap(pixmap);
        newIcon->move(event->pos() - offset);
        newIcon->show();
        newIcon->setAttribute(Qt::WA_DeleteOnClose);

        if (event->source() == this) {
            event->setDropAction(Qt::MoveAction);
            event->accept();
        } else {
            event->acceptProposedAction();
        }
    } else {
//-----------------------------------------------------------------------------
int ctkVTKScalarsToColorsUtilsTest1(int argc, char * argv [] )
{
  QApplication app(argc, argv);

  vtkSmartPointer<vtkColorTransferFunction> ctf =
    vtkSmartPointer<vtkColorTransferFunction>::New();
  ctf->AddRGBPoint(-0.5, 194./255,  78./255,  68./255);
  ctf->AddRGBPoint(2.2, 194./255, 141./255,  68./255);
  ctf->AddRGBPoint(3.3,  68./255, 194./255,  78./255);
  ctf->AddRGBPoint(4.8,  68./255, 194./255, 141./255);
  ctf->AddRGBPoint(5.9,  78./255,  68./255, 194./255);
  ctf->AddRGBPoint(7.0, 141./255,  68./255, 194./255);
  
  QImage image = ctk::scalarsToColorsImage(ctf);

  QLabel label;
  label.setPixmap( QPixmap::fromImage(image));
  label.show();

  QLabel label2;
  label2.setText( QString("<img src=\"%1\">: text")
    .arg(ctk::base64HTMLImageTagSrc(image)));
  label2.show();
  
  if (argc < 2 || QString(argv[1]) != "-I")
    {
    QTimer::singleShot(200, &app, SLOT(quit()));
    }
  return app.exec();
}
Пример #30
0
void MainWindow::refreshLives()
{
    if(playerHitted)
    {
        playerHitted = false;
        clearLives();

        int lives = player->lives;
        int position = GAME_WIDTH - 150;

        for(int i = 0; i < lives; i++)
        {
            QLabel* label = new QLabel();
            QPixmap pix(":/miscelanious/assets/playerLife3_red.png");

            label->setParent(this);
            label->setPixmap(pix);

            label->move(position,30);
            label->show();
            position +=40;
            Lives->append(label);


        }

    }
}