コード例 #1
2
void MainWindow::funS()
{
    QLabel* l = new QLabel;
    l->setWindowTitle("Fun");
    l->setFixedSize(765, 500);

    QObject::connect( this, SIGNAL( closeSignal() ), l, SLOT( close() ) );

    QRect rect(l->contentsRect());
    QPainter painter;

    QImage resultImage(rect.size(), QImage::Format_ARGB32_Premultiplied);

    painter.begin(&resultImage);
    painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
    painter.eraseRect(rect);
    painter.drawImage(rect, resultImage);
    painter.end();

    painter.begin(&resultImage);
    painter.setCompositionMode(QPainter::CompositionMode_Darken);

    for(int i = 0; i < 765; i++)
    {
        if(i<256)
            painter.setPen(QPen(QColor(255, i, 0), 1));
        else if(i < 512)
            painter.setPen(QPen(QColor(511-i, 255, i-256), 1));
            else
                painter.setPen(QPen(QColor(i-512, 765-i, 255), 1));

        painter.drawLine(i, 0, i, 500);
    }
    painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
    painter.drawImage(rect, resultImage);
    painter.end();

    l->setPixmap(QPixmap::fromImage(resultImage));
    l->show();

    QObject::connect( this, SIGNAL( closeSignal() ), l, SLOT( close() ) );
}
コード例 #2
0
void WindowUser::ReadXML()
{


        doc.LoadFile();

       TiXmlNode *patr=doc.FirstChild();


    int i=0;
    while(patr){
        int x,y;


        TiXmlAttribute *atrX =patr->ToElement()->FirstAttribute();
        TiXmlAttribute *atrY =patr->ToElement()->LastAttribute();


        atrX->Next()->QueryIntValue(&x);
        //cout<<x<<endl;

        atrY->QueryIntValue(&y);
        //cout<<y<<endl;


//        cout<<patr->ToElement()->Attribute("Codigo")<<endl;
//        cout<<patr->ToElement()->Attribute("X")<<endl;
//        cout<<patr->ToElement()->Attribute("Y")<<endl;

          QLabel *pin =new QLabel(this);
          QPixmap qp=QPixmap(":/imgs/map-pin-md.png");
          pin->setPixmap(qp);
          pin->setGeometry(x,y,20,25);
          pin->setScaledContents(true);
          pin->raise();
          pin->show();
        patr=patr->NextSibling();
        i++;
    }



}
コード例 #3
0
QWidget *AppAboutPage::createPage(QWidget *parent)
{
    QWidget *w = new QWidget(parent);
    QVBoxLayout *layout = new QVBoxLayout(w);
    layout->setSpacing(0);
    layout->setMargin(0);

    // Splash label
    QWidget *sw = new QWidget(w);
    QHBoxLayout *swLayout = new QHBoxLayout(sw);
    sw->setLayout(swLayout);
    QLabel *splash = new QLabel(w);
    splash->setPixmap(theme()->splashScreenPixmap(settings()->path(Core::ISettings::SplashScreen)));
    splash->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    swLayout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding));
    swLayout->addWidget(splash);
    swLayout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding));
    layout->addWidget(sw);
    QFrame *line = new QFrame(w);
    line->setFrameShape(QFrame::HLine);
    line->setFrameShadow(QFrame::Sunken);
    layout->addWidget(line);
    layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed));

    // Welcome label
    QLabel *label = new QLabel(w);
    label->setWordWrap(true);
    label->setOpenExternalLinks(true);
    layout->addWidget(label);
    layout->addSpacerItem(new QSpacerItem(20,20, QSizePolicy::Expanding, QSizePolicy::Expanding));
    label->clear();
        Utils::UpdateChecker *up = Core::ICore::instance()->updateChecker();
    QString tmp = tkTr(Trans::Constants::APPLICATION_ABOUT_YEAR_1_WEB_2)
                   .arg(QDate::currentDate().year())
                   .arg(qApp->organizationDomain());
    if (up->hasUpdate()) {
        tmp.append(tkTr(Trans::Constants::UPDATE_AVAILABLE));
    } else {
        tmp.append(tkTr(Trans::Constants::VERSION_UPTODATE));
    }
    label->setText(tmp);
    return w;
}
コード例 #4
0
ファイル: tupbrushstatus.cpp プロジェクト: hpsaturn/tupi
TupBrushStatus::TupBrushStatus(const QString &label, const QPixmap &pix, bool bg)
{
    background = bg;

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setMargin(2);
    layout->setSpacing(2);

    brush = new TupColorWidget;
    connect(brush, SIGNAL(clicked()), this, SLOT(updateColour()));

    QLabel *icon = new QLabel("");
    icon->setToolTip(label);
    icon->setPixmap(pix);

    layout->addWidget(icon);
    layout->addSpacing(3);
    layout->addWidget(brush);
}
コード例 #5
0
void QtkMainWindow::updateRenderImage(const int target,QImage *newImage)
{
	QLabel *drawed = NULL;
	if(target == 0)
		drawed = _localLabel;
	else if(target == 1)
		drawed = _remoteLabel;
	if(drawed != NULL && !newImage->isNull() && newImage->width() > 0 && newImage->height() > 0)
	{
		drawed->setFixedSize(newImage->width(),newImage->height());
		drawed->setPixmap(QPixmap::fromImage(*newImage));
		drawed->show();
	}
	if(target == 0)
		local_renderer_->turnUpdated();
	else if(target == 1)
		remote_renderer_->turnUpdated();

}
コード例 #6
0
ファイル: virusgenius.cpp プロジェクト: Theov/AI_GAMES
void VirusGenius::changeCaseImage(int x, int y, QString Image)
{
	QImage img;
	QString pathOfImageToLoad;

	if (Image == "black")
		pathOfImageToLoad = imageBlackPath;
	else if (Image == "white")
		pathOfImageToLoad = imageWhitePath;
	else
		pathOfImageToLoad = imageEmptyPath;

	img.load(pathOfImageToLoad);

	QLabel* lab = (QLabel*) ui.gridLayout->itemAtPosition(x, y)->widget();
	lab->setPixmap(QPixmap::fromImage(img));
	lab->setFixedWidth(img.width());
	lab->setFixedHeight(img.height());
}
コード例 #7
0
void AlbumCoverChoiceController::ShowCover(const Song& song) {
  QDialog* dialog = new QDialog(this);
  dialog->setAttribute(Qt::WA_DeleteOnClose, true);

  // Use Artist - Album as the window title
  QString title_text(song.albumartist());
  if (title_text.isEmpty()) title_text = song.artist();

  if (!song.album().isEmpty()) title_text += " - " + song.album();

  dialog->setWindowTitle(title_text);

  QLabel* label = new QLabel(dialog);
  label->setPixmap(AlbumCoverLoader::TryLoadPixmap(
      song.art_automatic(), song.art_manual(), song.url().toLocalFile()));

  dialog->resize(label->pixmap()->size());
  dialog->show();
}
コード例 #8
0
void ThemeStandard::_initUi()
{
    setFrameStyle( QFrame::NoFrame );

    QString pixName = mTheme->locateThemeData( mSplashScreen );

    if( mSplashScreen == "(Default)" || pixName.isEmpty() )
    {
        QString resource_prefix = "pics/";
        if ( mTheme->loColor() )
            resource_prefix += "locolor/";
        pixName = locate( "appdata", resource_prefix + "splash.png");
    }

    QPixmap px = QPixmap( pixName );

    if( !px.isNull() )
    {
        //kdDebug() << "Loaded splash " << mSplashScreen << endl;
        int pw = px.width();
        int ph = px.height();

        QLabel *lbl = new QLabel( this );
        lbl->setBackgroundMode( NoBackground );
        lbl->setFixedSize( pw, ph );
        lbl->setPixmap( px );

        resize( pw, ph );
    }
    else
    {
        //kdDebug() << "Couldn't load splash " << mSplashScreen << endl;
        resize( 0, 0 );
    }

    const QRect rect = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() );
    // KGlobalSettings::splashScreenDesktopGeometry(); cannot be used here.

    move( rect.x() + (rect.width() - size().width())/2,
          rect.y() + (rect.height() - size().height())/2 );

    mStatus = new WndStatus( QPalette(), mTheme->xineramaScreen(), mSbAtTop, mSbPbVisible, mSbFont, mSbFg, mSbBg, mSbIcon );
}
コード例 #9
0
ファイル: aboutdlg.cpp プロジェクト: WeiqiJust/CHER-Ob
QLayout * AboutDlg::initHPButtonLayout()
{
    // Lay out the HP logo and OK button

    QLabel * hpLogo = new QLabel();
    hpLogo->setMaximumSize(141, 116);
    hpLogo->setPixmap(QPixmap(":/images/hptran.png"));
    hpLogo->setAlignment(Qt::AlignCenter);

    QLayout * buttonLayout = initButtonLayout();

    QVBoxLayout * hpButtonLayout = new QVBoxLayout();
    hpButtonLayout->addWidget(hpLogo);
    hpButtonLayout->addStretch(1);
    hpButtonLayout->addLayout(buttonLayout);
    hpButtonLayout->addStretch(1);

    return hpButtonLayout;
}
コード例 #10
0
ファイル: uvision.cpp プロジェクト: githubcjl/uVision_cjl
void uVision::addThumbnail(QImage smallpm)
{
	static int i = 0;
	static int j = 0;
	//qWarning() << "thumbnail create successfully..." << j << i ;
	//qWarning() << "Small PM:"<<smallpm << smallpm.size();
	QLabel* label = new QLabel;
	label->setPixmap(QPixmap::fromImage(smallpm));
	QGridLayout* gl = qobject_cast<QGridLayout*>(previewwidget->layout());
	gl->addWidget(label, j, i);
	label->show();
	qWarning() << "Label:" <<label << label->isVisible();
	i++;
	if( i > previewwidget->width() / smallpm.width()) 
	{
		i = 0;
		j ++;
	}
}
コード例 #11
0
void BitcreditGUI::createToolBars()
{
	QLabel *mylabel = new QLabel(this);
	mylabel->setPixmap(QPixmap(":images/head"));
	mylabel->show();
    QToolBar *toolbar = addToolBar(tr("Menu"));
    toolbar->setObjectName("toolbar");
    addToolBar(Qt::LeftToolBarArea, toolbar);
    toolbar->addWidget(mylabel);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setMovable(false);
    toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	toolbar->setIconSize(QSize(50,20));
	
	
    if(walletFrame)
    {
		
		toolbar->addAction(overviewAction);
        toolbar->addAction(sendCoinsAction);
        toolbar->addAction(receiveCoinsAction);
        toolbar->addAction(historyAction);
		toolbar->addAction(exchangeAction);
		toolbar->addAction(blockAction);
		toolbar->addAction(bankstatsAction);		        
	    toolbar->addAction(sendMessagesAction);
	    toolbar->addAction(messageAction);
	    toolbar->addAction(invoiceAction);
	    toolbar->addAction(receiptAction);		
		toolbar->addAction(voteCoinsAction);
		toolbar->addAction(chatAction);
		
        overviewAction->setChecked(true);
    }
    
    //QWidget* spacer = new QWidget();
   // spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   // toolbar->addWidget(spacer);
    toolbar->addAction(optionsAction);
    //spacer->setObjectName("spacer");
    toolbar->setStyleSheet("#toolbar { font-weight:600;border:none;height:100%;padding-top:20px; background: rgb(0, 0, 0); text-align: left; color: white;min-width:180px;max-width:180px;} QToolBar QToolButton:hover {background:rgb(28, 29, 33);} QToolBar QToolButton:checked {background:rgba(28, 29, 33, 100);}  QToolBar QToolButton { font-weight:600;font-size:10px;font-family:'Century Gothic';padding-left:20px;padding-right:181px;padding-top:4px;padding-bottom:4px; width:100%; color: white; text-align: left; background:transparent;text-transform:uppercase; }");
        	
}
コード例 #12
0
ファイル: AMWorkflowView3.cpp プロジェクト: acquaman/acquaman
AMWorkflowView3::AMWorkflowView3(AMActionRunner3 *actionRunner, QWidget *parent) :
	QWidget(parent)
{
	layoutSpacer_ = 0;

	QHBoxLayout* hl = new QHBoxLayout();
	hl->setContentsMargins(12,12,12,12);
	hl->setSpacing(12);

	QLabel* titleIcon = new QLabel();
	titleIcon->setMaximumSize(36,36);
	titleIcon->setPixmap(QPixmap(":/user-away.png"));
	titleIcon->setScaledContents(true);
	hl->addWidget(titleIcon);
	QLabel* titleLabel = new QLabel(actionRunner->actionRunnerTitle());
	titleLabel->setStyleSheet("font: " AM_FONT_XLARGE_ "pt \"Lucida Grande\";\ncolor: rgb(79, 79, 79);");
	hl->addWidget(titleLabel);
	hl->addStretch(1);
	addActionButton_ = new QPushButton("Add Action...");
	hl->addWidget(addActionButton_);

	currentView_ = new AMActionRunnerCurrentView3(actionRunner);
	queueView_ = new AMActionRunnerQueueView3(actionRunner);
	historyView_ = new AMActionHistoryView3(actionRunner, actionRunner->loggingDatabase());
	addActionDialog_ = 0;

	QVBoxLayout* vl = new QVBoxLayout();
	vl->setContentsMargins(0,0,0,0);
	vl->setSpacing(0);

	vl->addLayout(hl);
	vl->addWidget(historyView_);
	vl->addSpacing(12);
	vl->addWidget(currentView_);
	vl->addSpacing(12);
	vl->addWidget(queueView_);

	setLayout(vl);

	connect(queueView_, SIGNAL(collapsed(bool)), this, SLOT(onViewCollapsed()));
	connect(historyView_, SIGNAL(collapsed(bool)), this, SLOT(onViewCollapsed()));
	connect(addActionButton_, SIGNAL(clicked()), this, SLOT(onAddActionButtonClicked()));
}
コード例 #13
0
ZAboutDialog::ZAboutDialog()
    :MyBaseDlg()
{
  setMainWidgetTitle ( "zCleaner" );

  QString ProgDir = QString ( qApp->argv() [0] ) ;
  int i = ProgDir.findRev ( "/" );
  ProgDir.remove ( i+1, ProgDir.length() - i );
  QWidget *myWidget = new QWidget ( this );
  //myWidget->setGeometry(0,0,240,320);
  QVBoxLayout *myVBoxLayout = new QVBoxLayout ( myWidget, 0 );
  QHBoxLayout *myHBoxLayout = new QHBoxLayout;
  myHBoxLayout->setSpacing ( 4 );
  myHBoxLayout->setMargin ( 0 );

  QLabel *myLabel = new QLabel ( myWidget );
  myLabel->setPixmap ( QPixmap ( "folder.png" ) );
  myLabel->setScaledContents ( false );
  myHBoxLayout->addWidget ( myLabel );

  myLabel = new QLabel ( QString ( "<qt><img src=%1/img/zCleaner_usr.png><br>"
"<qt>zCleaner 0.3 by c_ro87<br>" "<qt>Base GUI zGui 0.7.4g by BeZ<br>"
                                   "<font size=\"-1\">zCleaner is a simple antivirus for Z6</font></qt>" ).arg(ProgDir), myWidget );
  myHBoxLayout->addWidget ( myLabel, 1 );
  myVBoxLayout->addLayout ( myHBoxLayout );

  myLabel = new QLabel ( QString ( "<qt><font size=\"-1\"><p>Copyright (C) 2008 c_ro87<br>"
                                   "<tt>&lt;[email protected]&gt;</tt><br></font></qt>" ),
                         myWidget );
  myVBoxLayout->addWidget ( myLabel );

  QSpacerItem* spacer = new QSpacerItem ( 8, 8, QSizePolicy::Minimum, QSizePolicy::Expanding );
  myVBoxLayout->addItem ( spacer );

  myLabel = new QLabel ( "www.modmymoto.com", myWidget );
  myVBoxLayout->addWidget ( myLabel );
  setContentWidget ( myWidget );

  ZSoftKey *softKey = new ZSoftKey ( NULL, this, this );
  softKey->setText ( ZSoftKey::LEFT, "OK", ( ZSoftKey::TEXT_PRIORITY ) 0 );
  softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( accept() ) );
  setCSTWidget ( softKey );
}
コード例 #14
0
ファイル: demowidget.cpp プロジェクト: Iownnoname/qt
DemoWidget::DemoWidget(QWidget* _parent)
    : QWidget(_parent)
{
    QLightBoxWidget* lightBox = new QLightBoxWidget(this);

    QLabel* text = new QLabel("Some information in <b>html</b> format<br/>"
                              "<ul><li>one</li><li>two</li><li>three</li></ul>");
    QLabel* image = new QLabel;
    image->setPixmap(QPixmap(":/image.jpg"));
    QPushButton* showLB = new QPushButton(tr("Show"));

    QGridLayout* mainLayout = new QGridLayout;
    mainLayout->addWidget(text, 0, 0, Qt::AlignTop);
    mainLayout->addWidget(image, 0, 1);
    mainLayout->addWidget(showLB, 1, 1);

    this->setLayout(mainLayout);

    QLabel* lbTitle = new QLabel(tr("QLightBoxWidget"));
    lbTitle->setStyleSheet("font-size: 28px; font-weight: bold; color: white");
    QLabel* lbProgress = new QLabel;
    QMovie* progressMovie = new QMovie(":/loader.gif");
    lbProgress->setMovie(progressMovie);
    progressMovie->start();
    QLabel* lbDescription = new QLabel(tr("Example how to use QLightBoxWidget\n"
                                          "in your QtWidgets applications..."));
    lbDescription->setStyleSheet("color: white");
    QPushButton* lbClose = new QPushButton(tr("Close"));

    QGridLayout* lbLayout = new QGridLayout;
    lbLayout->setRowStretch(0, 1);
    lbLayout->setColumnStretch(0, 1);
    lbLayout->addWidget(lbTitle, 1, 1);
    lbLayout->addWidget(lbProgress, 1, 2, Qt::AlignRight);
    lbLayout->setColumnStretch(3, 1);
    lbLayout->addWidget(lbDescription, 2, 1, 1, 2);
    lbLayout->addWidget(lbClose, 3, 2);
    lbLayout->setRowStretch(4, 1);

    connect(showLB, SIGNAL(clicked()), lightBox, SLOT(show()));
    connect(lbClose, SIGNAL(clicked()), lightBox, SLOT(hide()));
    lightBox->setLayout(lbLayout);
}
コード例 #15
0
ファイル: aboutqucs.cpp プロジェクト: damiansimanuk/qucs-qt4
//!  @return The title Qucs with its icon
QWidget *AboutQUCS::title() const
{
    QWidget *icon_and_title = new QWidget();
    // icon
    QLabel *icon = new QLabel();
    icon->setPixmap(QPixmap(Qucs::bitmapDirectory() + "qucs.png"));
    // label "Qucs"
    QLabel *title = new QLabel("<span style=\"font-weight:0;font-size:16pt;\">Qucs v"
            + Qucs::version + "</span>");
    title->setTextFormat(Qt::RichText);
    // All in a grid
    QGridLayout *grid_layout = new QGridLayout();
    grid_layout->addWidget(icon, 0, 0);
    grid_layout->addWidget(title, 0, 1);
    grid_layout->setColumnStretch(0, 1);
    grid_layout->setColumnStretch(1, 100);
    icon_and_title->setLayout(grid_layout);
    return icon_and_title;
}
コード例 #16
0
ファイル: test.cpp プロジェクト: flaska/DPEngine
int main(int argc, char *argv[]){
	QApplication a(argc, argv);
	QImage *im = new QImage(250,250,QImage::Format_RGB16);

	QPainter p;
    p.begin((QPaintDevice*)im);
	p.setPen(QPen(QColor(100,100,100), 5, Qt::SolidLine, Qt::RoundCap,Qt::RoundJoin));
    p.drawEllipse (10,10,50,50);        // drawing code
    p.end();

	QLabel *label = new QLabel();
	QPixmap *pix = new QPixmap(250,250);
	pix->convertFromImage(*im);

	label->setPixmap(*pix);
	label->show();

	return a.exec();
}
コード例 #17
0
void Parameter_LED8x8_Form::initSetting()
{
    //this->setWindowState(Qt::WindowActive);
    this->installEventFilter(this);
    this->setFocus();

    this->setAttribute(Qt::WA_TranslucentBackground, true);
    //恩原来是tool
    this->setWindowFlags(Qt::FramelessWindowHint /*| Qt::Tool*/);

    pushButton->setWindowFlags(Qt::FramelessWindowHint);
    pushButton->setAttribute(Qt::WA_TranslucentBackground);

    for (int i = 0 ; i < 8 ; i ++){
        for (int j = 0 ; j < 8 ; j ++){
            ledState_[i*8+j] = 0;
        }
    }


    int widget_pos_x = (rect_.width() - widgetBg->width()) / 2;   //根据屏幕分辨率 计算窗体位置
    int widget_pos_y = (rect_.height() - widgetBg->height()) / 2;
    int bgi_pos_x = bgimage->x();
    int bgi_pos_y = bgimage->y();

    QPixmap singleLED_Dark("resource/images/parameter_input/LED_Matrix/ParameterSetup_8x8LED_Single_Dark.png");

    for (int i = 0 ; i < 8 ; i ++){
        for (int j = 0 ; j < 8 ; j ++){
            QLabel *p = new QLabel(this);
            p->setObjectName(QString::number((i*8+j)));

            p->move(widget_pos_x + bgi_pos_x + 5 + j*43,widget_pos_y + bgi_pos_y + 5 + i*43);
            p->resize(32,32);
            p->setPixmap(singleLED_Dark);

            p->setAttribute(Qt::WA_TranslucentBackground);
            LEDsList_.append(p);
            ledState_[j*8+i] = 0;
        }
    }

}
コード例 #18
0
ファイル: bitcoingui.cpp プロジェクト: lin0sspice/pentacoin
void BitcoinGUI::createToolBars()
{
    QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
    toolbar->setObjectName("toolbar");
    addToolBar(Qt::LeftToolBarArea,toolbar);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setMovable( false );
    toolbar->setToolButtonStyle(Qt::ToolButtonTextOnly);
	QLabel *l = new QLabel(this);
    l->setPixmap(QPixmap(":/images/spacer"));
    toolbar->addWidget(l);
    toolbar->addAction(overviewAction);
    toolbar->addAction(sendCoinsAction);
    toolbar->addAction(receiveCoinsAction);
    toolbar->addAction(historyAction);
    toolbar->addAction(addressBookAction);
    toolbar->addAction(masternodeManagerAction);
	toolbar->setStyleSheet("#toolbar { border:1px;height:100%;padding-top:100px; background: transparent; text-align: center; color: black;min-width:200px;max-width:200px;} QToolBar QToolButton:hover {background-image: url(:images/toolbtnh); background-color: transparent;} QToolBar QToolButton:selected {background-color: transparent;} QToolBar QToolButton:checked {background-image: url(:images/toolbtns); background-color: transparent;} QToolBar QToolButton:pressed {background-color: transparent;} QToolBar QToolButton { margin: 2px; background-image:url(:images/toolbtn); font-family:'Bebas'; font-size:14px; min-width:160px;max-width:160px; min-height:40px;max-height:40px; color: white; text-align: center; }");
}
コード例 #19
0
ファイル: arkviewer.cpp プロジェクト: fluxer/kde-extraapps
bool ArkViewer::viewInInternalViewer(const QString& fileName, const KMimeType::Ptr& mimeType)
{
    const KUrl fileUrl(fileName);

    setCaption(fileUrl.fileName());
    restoreDialogSize(KGlobal::config()->group("Viewer"));

    QFrame *header = new QFrame(m_widget);
    QHBoxLayout *headerLayout = new QHBoxLayout(header);

    QLabel *iconLabel = new QLabel(header);
    headerLayout->addWidget(iconLabel);
    iconLabel->setPixmap(KIconLoader::global()->loadMimeTypeIcon(mimeType->iconName(), KIconLoader::Desktop));
    iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);

    KVBox *headerRight = new KVBox(header);
    headerLayout->addWidget(headerRight);
    new QLabel(QString(QLatin1String( "<qt><b>%1</b></qt>" ))
               .arg(fileUrl.fileName()), headerRight
              );
    new QLabel(mimeType->comment(), headerRight);

    header->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);

    m_part = KMimeTypeTrader::self()->createPartInstanceFromQuery<KParts::ReadOnlyPart>(mimeType->name(),
             m_widget,
             this);

    if (!m_part.data()) {
        return false;
    }

    if (m_part.data()->browserExtension()) {
        connect(m_part.data()->browserExtension(),
                SIGNAL(openUrlRequestDelayed(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)),
                SLOT(slotOpenUrlRequestDelayed(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)));
    }

    m_part.data()->openUrl(fileUrl);

    return true;
}
コード例 #20
0
ファイル: FindWidget.cpp プロジェクト: Artanomell/schat
FindWidget::FindWidget(QWidget *parent)
  : QFrame(parent)
{
  installEventFilter(this);

  m_toolBar = new QToolBar(this);
  m_toolBar->setIconSize(QSize(16, 16));

  QLabel *label = new QLabel(this);
  label->setPixmap(QPixmap(LS(":/images/search.png")));

  m_editFind = new SLineEdit(this);
  m_editFind->addWidget(label, LineEdit::LeftSide);
  m_editFind->setWidgetSpacing(3);
  m_editFind->installEventFilter(this);

  m_toolBar->addWidget(m_editFind);
  m_previous = m_toolBar->addAction(QIcon(LS(":/images/find_previous.png")), tr("Previous"));
  m_next = m_toolBar->addAction(QIcon(LS(":/images/find_next.png")), tr("Next"));
  m_toolBar->addSeparator();
  m_close = m_toolBar->addAction(QIcon(LS(":/images/stop.png")), tr("Close"));

  QHBoxLayout *mainLay = new QHBoxLayout(this);
  mainLay->addWidget(m_toolBar);

# if defined(Q_OS_MACX)
  mainLay->setMargin(0);
# else
  mainLay->setMargin(4);
# endif

# if defined(Q_OS_WIN32)
  setObjectName(LS("FindWidget"));
  setStyleSheet(QString("FindWidget { background-color:%1; }").arg(palette().color(QPalette::Window).name()));
# endif

  setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

  connect(m_editFind, SIGNAL(returnPressed()), SLOT(find()));
  connect(m_editFind, SIGNAL(textChanged(QString)), SLOT(find()));
  connect(m_toolBar, SIGNAL(actionTriggered(QAction*)), SLOT(actionTriggered(QAction*)));
}
コード例 #21
0
ZAboutDialog::ZAboutDialog()
    :MyBaseDlg()
{

  setMainWidgetTitle ( "Z6 Manager" );

  QString ProgDir = QString ( qApp->argv() [0] ) ;
  int i = ProgDir.findRev ( "/" );
  ProgDir.remove ( i+1, ProgDir.length() - i );

  QWidget *myWidget = new QWidget ( this );
  //myWidget->setGeometry(0,0,240,320);
  QVBoxLayout *myVBoxLayout = new QVBoxLayout ( myWidget, 0 );
  QHBoxLayout *myHBoxLayout = new QHBoxLayout;
  myHBoxLayout->setSpacing ( 4 );
  myHBoxLayout->setMargin ( 10 );

  QLabel *myLabel = new QLabel ( myWidget );
  myLabel->setPixmap ( QPixmap ( "" ) );
  myLabel->setScaledContents ( false );
  myHBoxLayout->addWidget ( myLabel );

  myLabel = new QLabel ( QString ( "<qt><img src=%1/images/icon.png><br>"
                                   "<font size=\"+1\">Z6 Manager </font><font size=\"-1\">"
                                   "  v2.1<br><br>Motorola Z6 Linuxmod 2.1<br><br>developermoto.com/es<br>modmymoto.com<br>"
                                   "<br>(C) 2009. <br>CepiPerez / segnini75 / c_ro87"
                                   "</font></qt>" ).arg(ProgDir) , myWidget );
  myHBoxLayout->addWidget ( myLabel, 1 );
  myVBoxLayout->addLayout ( myHBoxLayout );

  QSpacerItem* spacer = new QSpacerItem ( 8, 8, QSizePolicy::Minimum, QSizePolicy::Expanding );
  myVBoxLayout->addItem ( spacer );

  //myLabel = new QLabel ( "Licensed under the GNU GPL.", myWidget );
  //myVBoxLayout->addWidget ( myLabel );
  setContentWidget ( myWidget );

  ZSoftKey *softKey = new ZSoftKey ( NULL, this, this );
  softKey->setText ( ZSoftKey::LEFT, "Aceptar", ( ZSoftKey::TEXT_PRIORITY ) 0 );
  softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( accept() ) );
  setCSTWidget ( softKey );
}
コード例 #22
0
ファイル: CAbout.cpp プロジェクト: greenplum-db/gpclients
CAbout::CAbout( QWidget *pwidgetParent, const char *pszName )
	: QWidget( pwidgetParent, pszName )
{
    QVBoxLayout *   playoutTop;
    QHBoxLayout *   playoutHelp;
    CAboutDiagram * pdiagram;
    QFrame *        pframeHelp;
	QLabel *        plabelIcon;
	QLabel *        plabelText;
	QPushButton *   ppushbuttonCredits;

    playoutTop          = new QVBoxLayout( this, 5 );

    // DIAGRAM
    pdiagram            = new CAboutDiagram( this );

    playoutTop->addWidget( pdiagram, 10 );

    // HELP - FRAME
    pframeHelp          = new QFrame( this );
    pframeHelp->setFrameStyle( QFrame::Box | QFrame::Raised );

    playoutTop->addWidget( pframeHelp );

    //
    playoutHelp         = new QHBoxLayout( pframeHelp, 5 );

	plabelIcon          = new QLabel( pframeHelp );
    plabelIcon->setPixmap( xpmAbout );

	plabelText          = new QLabel( pframeHelp );
	plabelText->setText( "Open DataBase Connectivity (ODBC) was developed to be an Open and portable standard for accessing data. unixODBC implements this standard for Linux/UNIX.\nhttp://www.unixodbc.org" );
	plabelText->setAlignment(  AlignLeft | WordBreak  );

	ppushbuttonCredits  = new QPushButton( pframeHelp );
	connect( ppushbuttonCredits, SIGNAL(clicked()), SLOT(pbCredits_Clicked()) );
	ppushbuttonCredits->setText( "&Credits" );

    playoutHelp->addWidget( plabelIcon );
    playoutHelp->addWidget( plabelText, 10 );
    playoutHelp->addWidget( ppushbuttonCredits );
}
コード例 #23
0
ファイル: Main.cpp プロジェクト: pengwg/gridding2d
void displayData(int n0, int n1, const complexVector& data, const QString& title)
{
    QVector<float> dataValue;

    float max = 0;
    float min = FLT_MAX;

    for (auto cValue : data) {
        float value = std::abs(cValue);
        if (value > max) max = value;
        if (value < min) min = value;

        dataValue << value;
    }

    QImage dataImage(n1, n0, QImage::Format_Indexed8);
    for (int i = 0; i < 256; i++) {
        dataImage.setColor(i, qRgb(i, i, i));
    }

    int i = 0;
    for (int y = 0; y < n0; y++) {
        auto imageLine = dataImage.scanLine(y);

        for (int x = 0; x < n1; x++) {
            uint idx;
            if (max == min)
                idx = 127;
            else
                idx = (dataValue[i] - min) / (max - min) * 255;
            imageLine[x] = idx;
            i++;
        }
    }

    QPixmap pixmap = QPixmap::fromImage(dataImage);

    QLabel *imgWnd = new QLabel("Image Window");
    imgWnd->setWindowTitle(title);
    imgWnd->setPixmap(pixmap);
    imgWnd->show();
}
コード例 #24
0
ファイル: mainwindow.cpp プロジェクト: beawar/HBStats
void MainWindow::createLogoWidget(){
    logoWidget = new QWidget(this);
    QLabel* logoLabel = new QLabel(logoWidget);
    logoLabel->setPixmap(QPixmap(":/images/images/HBStats_Icon_Sfondo.png").scaled(500, 500, Qt::KeepAspectRatio));

    QWidget* topFiller = new QWidget(logoWidget);
    topFiller->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QWidget* bottomFiller = new QWidget(logoWidget);
    bottomFiller->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QVBoxLayout* layout = new QVBoxLayout;
    layout->addWidget(topFiller);
    layout->addWidget(logoLabel);
    layout->addWidget(bottomFiller);

    layout->setAlignment(logoLabel, Qt::AlignHCenter);

    logoWidget->setLayout(layout);
}
コード例 #25
0
ファイル: main.cpp プロジェクト: RafaelSilvaAlbuquerque/CGII
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //MainWindow w;
    //w.show();

    int linha=800,coluna=800;

    QImage image(linha, coluna, QImage::Format_RGB32);

    Display tela;

    QLabel myLabel;
    myLabel.setPixmap(QPixmap::fromImage(tela.draw(image,linha,coluna)));
    myLabel.show();

    return a.exec();


}
コード例 #26
0
ファイル: SelectFaceBox.cpp プロジェクト: ahmidou/aphid
SelectFaceBox::SelectFaceBox(QWidget *parent) : QGroupBox(parent)
{
	QPixmap *pix = new QPixmap(":selectFaceActive.png");
	QLabel * img = new QLabel;
	img->setPixmap(*pix);
	m_radiusValue = new QDoubleEditSlider(tr("Radius"));
	m_radiusValue->setLimit(0.01, 1000.0);
	m_radiusValue->setValue(1.0);
	m_twoSidedCheck = new QCheckBox(tr("Front And Back Side"));
	QVBoxLayout * controlLayout = new QVBoxLayout;
	controlLayout->addWidget(img);
	controlLayout->addWidget(m_radiusValue);
	controlLayout->addWidget(m_twoSidedCheck);
	controlLayout->addStretch();
	setLayout(controlLayout);
	setTitle(tr("Select Face"));
	
	connect(m_radiusValue, SIGNAL(valueChanged(double)), this, SLOT(sendRadius(double)));
	connect(m_twoSidedCheck, SIGNAL(stateChanged(int)), this, SLOT(sendTwoSided(int)));
}
コード例 #27
0
MagatamaWidget::MagatamaWidget(int hp, Qt::Orientation orientation)
{
    QBoxLayout *layout = NULL;
    if(orientation == Qt::Vertical)
        layout = new QVBoxLayout;
    else
        layout = new QHBoxLayout;

    QPixmap pixmap = *GetMagatama(qMin(5, hp));

    int i;
    for(i=0; i<hp; i++){
        QLabel *label = new QLabel;
        label->setPixmap(pixmap);

        layout->addWidget(label);
    }

    setLayout(layout);
}
コード例 #28
0
void Chessboard::mouseReleaseEvent(QMouseEvent *event) {
    int turn;
    if(event->button() == Qt::LeftButton) turn = BLACK;
    else if(event->button() == Qt::RightButton) turn = WHITE;
    else if(event->button() == Qt::MidButton) turn = EMPTY;
    else return;

    unsigned char stoneType = boardData.set(event->y() / SIZE_STONE, event->x() / SIZE_STONE, turn);
    if(stoneType != turn){
        err(false, "mouseReleaseEvent() boardData.set error: click at [%d, %d]\n", event->x(), event->y());
        return;
    }

    QLabel *frame = new QLabel(this);
    frame->setPixmap( stoneImg[stoneType].scaled(SIZE_STONE, SIZE_STONE) );
    frame->setGeometry( (event->x() / SIZE_STONE) * SIZE_STONE,
                        (event->y() / SIZE_STONE) * SIZE_STONE,
                        SIZE_STONE, SIZE_STONE);
    frame->show();
}
コード例 #29
0
ファイル: djvSearchBox.cpp プロジェクト: mottosso/djv
djvSearchBox::djvSearchBox(djvGuiContext * context, QWidget * parent) :
    QWidget(parent),
    _p(new djvSearchBoxPrivate)
{
    // Create the widgets.
    
    _p->lineEdit = new QLineEdit;
    _p->lineEdit->setToolTip(
        qApp->translate("djvSearchBox", "Enter a search"));
    
    _p->resetButton = new djvToolButton;
    _p->resetButton->setIconSize(QSize(16, 16));
    _p->resetButton->setIcon(
        context->iconLibrary()->icon("djvResetIcon.png"));
    _p->resetButton->setToolTip(
        qApp->translate("djvSearchBox", "Reset the search"));

    QLabel * label = new QLabel;
    label->setPixmap(
        context->iconLibrary()->pixmap("djvMagnifyIcon.png"));
    
    // Layout the widgets.
    
    QHBoxLayout * layout = new QHBoxLayout(this);
    layout->setMargin(0);
    layout->addWidget(label);
    layout->addWidget(_p->lineEdit);
    layout->addWidget(_p->resetButton);
    
    // Setup callbacks.
    
    connect(
        _p->lineEdit,
        SIGNAL(textChanged(const QString &)),
        SLOT(textCallback(const QString &)));
    
    connect(
        _p->resetButton,
        SIGNAL(clicked()),
        SLOT(resetCallback()));
}
コード例 #30
0
void RenameLibraryDialog::setupUI()
{
	newNameLabel = new QLabel(tr("New Library Name : "));
	newNameEdit = new QLineEdit;
	newNameLabel->setBuddy(newNameEdit);
	connect(newNameEdit,SIGNAL(textChanged(QString)),this,SLOT(nameSetted(QString)));

	accept = new QPushButton(tr("Rename"));
	accept->setDisabled(true);
	connect(accept,SIGNAL(clicked()),this,SLOT(rename()));

	cancel = new QPushButton(tr("Cancel"));
	connect(cancel,SIGNAL(clicked()),this,SLOT(close()));

	QHBoxLayout *nameLayout = new QHBoxLayout;

	nameLayout->addWidget(newNameLabel);
	nameLayout->addWidget(newNameEdit);

	QHBoxLayout *bottomLayout = new QHBoxLayout;
	bottomLayout->addStretch();
	bottomLayout->addWidget(accept);
	bottomLayout->addWidget(cancel);

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addLayout(nameLayout);
	mainLayout->addStretch();
	mainLayout->addLayout(bottomLayout);

	QHBoxLayout * imgMainLayout = new QHBoxLayout;
	QLabel * imgLabel = new QLabel(this);
	QPixmap p(":/images/edit.png");
	imgLabel->setPixmap(p);
	imgMainLayout->addWidget(imgLabel);
	imgMainLayout->addLayout(mainLayout);
	
	setLayout(imgMainLayout);

	setModal(true);
	setWindowTitle(tr("Rename current library"));
}