コード例 #1
0
void  boxAvail::drawitems ()
{
    int x=190, y=30;
    QLabel *starter;
    itemLinker *starterLinker;

    starter = new QLabel(QString::number (source.first ()->getId ()),this);
    starterLinker = new itemLinker(0,&Server, this);

    starter->setFixedSize (30,30);
    starter->setAlignment (Qt::AlignCenter);
    starter->setFrameShape (QFrame::WinPanel);

    starter->move (20,30);
    starterLinker->draw(50,30);

    for(it=source.begin (); it!=source.end (); ++it){
        (*it)->draw(x,y);
        (*it)->show();
        x+=140;
        if ( this->width()-x < 150){
            x=20, y+=50;
        }
    }
}
コード例 #2
0
FlashableWidget::FlashableWidget(int width, int height, QWidget *parent):
    QWidget(parent) ,vLabels_(), width_(width), height_(height),
    vActiveLabels_(), inactiveLabelPalette(), activeLabelPalette(),
    backgroundPalette(), currentHalve(0), selectedHalveWidth(0),
    selectedHalveHeight(0), firstHalveWidth(0), firstHalveHeight(0),
    secondHalveWidth(0), secondHalveHeight(0)
{
    grid = new QGridLayout;

    QFont f("Helvetica", 20);
    for(int row = 0; row < height_; ++row)
    {
        for(int column = 0; column < width_; ++column)
        {
            QLabel *label = new QLabel();
            label->setFont(f);
            label->setScaledContents(true);
            label->setFrameShape(QFrame::Box);
            label->setLineWidth(3);
            label->setAlignment(Qt::AlignCenter);
            label->setPalette(inactiveLabelPalette);
            label->setAutoFillBackground(true);
            grid->addWidget(label, row, column);
            vLabels_.push_back(label);
        }
    }

    setLayout(grid);

    oneByOneIndex_ = 0;
}
コード例 #3
0
ファイル: widget.cpp プロジェクト: 2easy4wizzi/soduku
void Widget::build3x3frame(QFrame *box3x3frame, int rowStart, int colStart, int QMap)
{
    box3x3frame->setFrameStyle(QFrame::Plain);
    box3x3frame->setFrameShape(QFrame::Box);
    QGridLayout* box3x3 = new QGridLayout(box3x3frame);
    box3x3->setSpacing(0);
    box3x3->setMargin(0);
    int x = rowStart%9;
    for (int i = 0; i < 3; ++i)
    {
        int y = colStart%9;
        for (int j = 0; j < 3; ++j)
        {
            QLabel* cell = new QLabel("");
            cell->setAlignment(Qt::AlignCenter);
            //cell->setAlignment(Qt::AlignVCenter);
            if(QMap) originPointToCellMap.insert(QPair<int,int>(x,y++),cell);
            else     resultPointToCellMap.insert(QPair<int,int>(x,y++),cell);
            cell->setFrameStyle(QFrame::Plain);
            cell->setFrameShape(QFrame::Box);
            cell->setMargin(5);
            box3x3->addWidget(cell,i,j,1,1);
        }
        x++;
    }
}
コード例 #4
0
void KPrWebPresentationWizard::setupPage3()
{
    page3 = new QHBox( this );
    QWhatsThis::add( page3, i18n("This page allows you to specify the colors for "
                                 "your presentation display. Select individual "
                                 "items for more help on what they do.") );

    page3->setSpacing( KDialog::spacingHint() );
    page3->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page3 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page3 );
    QGridLayout *layout = new QGridLayout( canvas, 6, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft );
    helptext->setText( i18n( "Now you can customize the colors of the web pages." ) );
    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 50 ), 1, 1, 0, 1 );

    QLabel *label1 = new QLabel( i18n("Text color:"), canvas );
    label1->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label1, 2, 0 );

    QLabel *label2 = new QLabel( i18n("Title color:"), canvas );
    label2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label2, 3, 0 );

    QLabel *label3 = new QLabel( i18n("Background color:"), canvas );
    label3->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label3, 4, 0 );

    textColor = new KColorButton( webPres.getTextColor(), canvas );
    layout->addWidget( textColor, 2, 1 );

    titleColor = new KColorButton( webPres.getTitleColor(), canvas );
    layout->addWidget( titleColor, 3, 1 );

    backColor = new KColorButton( webPres.getBackColor(), canvas );
    layout->addWidget( backColor, 4, 1 );

    QSpacerItem* spacer = new QSpacerItem( 1, 10,
                                           QSizePolicy::Minimum, QSizePolicy::Expanding );
    layout->addMultiCell( spacer, 5, 5, 0, 1 );

    addPage( page3, i18n( "Step 3: Customize Colors" ) );

    setHelpEnabled(page3, false);  //doesn't do anything currently
}
コード例 #5
0
ファイル: iconpreviewarea.cpp プロジェクト: cedrus/qt4
//! [4]
QLabel *IconPreviewArea::createPixmapLabel()
{
    QLabel *label = new QLabel;
    label->setEnabled(false);
    label->setAlignment(Qt::AlignCenter);
    label->setFrameShape(QFrame::Box);
    label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    label->setBackgroundRole(QPalette::Base);
    label->setAutoFillBackground(true);
    label->setMinimumSize(132, 132);
    return label;
}
コード例 #6
0
ファイル: modelpanel.cpp プロジェクト: andyjenkinson/opentx
void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize)
{
  QLabel *label = new QLabel(this);
  label->setFrameShape(QFrame::Panel);
  label->setFrameShadow(QFrame::Raised);
  label->setMidLineWidth(0);
  label->setAlignment(Qt::AlignCenter);
  label->setMargin(5);
  label->setText(text);
  if (!minimize)
    label->setMinimumWidth(100);
  gridLayout->addWidget(label, 0, col, 1, 1);
}
コード例 #7
0
ファイル: telemetry.cpp プロジェクト: sneheshs/opentx
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, FirmwareInterface * firmware):
    ModelPanel(parent, model, generalSettings, firmware),
    ui(new Ui::TelemetryCustomScreen),
    screen(screen)
{
    ui->setupUi(this);

    for (int l=0; l<4; l++) {
        for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
            fieldsCB[l][c] = new QComboBox(this);
            fieldsCB[l][c]->setProperty("index", c + (l<<8));
            ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
            connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
        }
    }

    for (int l=0; l<4; l++) {
        barsCB[l] = new QComboBox(this);
        barsCB[l]->setProperty("index", l);
        connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
        ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);

        minSB[l] = new QDoubleSpinBox(this);
        minSB[l]->setProperty("index", l);
        connect(minSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMinChanged(double)));
        ui->screenBarsLayout->addWidget(minSB[l], l, 1, 1, 1);

        QLabel * label = new QLabel(this);
        label->setAutoFillBackground(false);
        label->setStyleSheet(QString::fromUtf8("Background:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 128, 255), stop:0.339795 rgba(0, 0, 128, 255), stop:0.339799 rgba(255, 255, 255, 255), stop:0.662444 rgba(255, 255, 255, 255),)\n"""));
        label->setFrameShape(QFrame::Panel);
        label->setFrameShadow(QFrame::Raised);
        label->setAlignment(Qt::AlignCenter);
        ui->screenBarsLayout->addWidget(label, l, 2, 1, 1);

        maxSB[l] = new QDoubleSpinBox(this);
        maxSB[l]->setProperty("index", l);
        connect(maxSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMaxChanged(double)));
        ui->screenBarsLayout->addWidget(maxSB[l], l, 3, 1, 1);
    }

    disableMouseScrolling();

    update();
}
コード例 #8
0
void DefinitionBoxWidget::setupGui(){
    ui->labelDefinition->show();
    ui->lineEditDefinition->hide();
    ui->labelDefinition->setText((m_definitionMap["value"]).toString());
    ui->lineEditDefinition->setText((m_definitionMap["value"]).toString());
    ui->plainTextEditExampleUsage->setPlainText((m_definitionMap["usage"]).toString());
    ui->plainTextEditNotes->setPlainText((m_definitionMap["notes"]).toString());

    this->setToolTip( ( m_definitionMap["key"]).toString().prepend(trUtf8("Definition of ")) );

    //Type tag
    if((m_definitionMap["type"]).toString() != QString()){
        QLabel *pTypeLabel = new QLabel((m_definitionMap["type"]).toString());
        pTypeLabel->setFrameShape(QFrame::StyledPanel);
        pTypeLabel->setEnabled(false);
        pTypeLabel->setToolTip(trUtf8("Word Type"));
        ui->horizontalLayoutTag->addWidget(pTypeLabel, 0, Qt::AlignLeft);
    }
    //TODO: sex tag
    //TODO: antonym-synonym tag
}
コード例 #9
0
ファイル: contextmenu.cpp プロジェクト: Fahad-Alsaidi/scribus
void ContextMenu::createMenuItems_Selection()
{
	//CB TODO clean
	int selectedItemCount=m_Sel.count();
	if (selectedItemCount==0)
		return;
	bool itemsAreSameType=m_Sel.itemsAreSameType();
	//Find our doc from first item in selection if we have an item
	PageItem *currItem = m_Sel.itemAt(0);
	assert(m_doc!=0 && currItem!=0);
	
	QMenu *menuConvertTo = new QMenu(this);
	QMenu *menuEditContent = new QMenu(this);
	QMenu *menuInfo = new QMenu(this);
	QMenu *menuLayer = new QMenu(this);
	QMenu *menuLevel = new QMenu(this);
	QMenu *menuPDF = new QMenu(this);
	QMenu *menuMark = new QMenu(this);
	QMenu *menuResolution = new QMenu(this);
	QMenu *menuLocking = new QMenu(this);
	QMenu *menuSendTo = new QMenu(this);
	QMenu *menuScrapbook = new QMenu(this);
	QMenu *menuEdit = new QMenu(this);
	QMenu *menuImage = new QMenu(this);
//	QMenu *menuWeld = new QMenu(this);

	//<-- Add Info
	//Test new method with image frames first
	if (selectedItemCount==1 && currItem->asImageFrame())
	{
		QAction *act = addMenu(menuInfo);
		act->setText( tr("In&fo"));
		if (currItem->asImageFrame())
		{
			QLabel* menuLabel = new QLabel("<html>" + currItem->infoDescription() + "</html>", this);
			menuLabel->setFrameShape(QFrame::NoFrame);
			QWidgetAction* menuTextWidget = new QWidgetAction(this);
			menuTextWidget->setDefaultWidget(menuLabel);
			menuInfo->addAction(menuTextWidget);
		}
	}
	else
	{
		QFrame *infoGroup = new QFrame( m_doc->view() );
		infoGroup->setFrameShape( QFrame::NoFrame );
		QGridLayout *infoGroupLayout = new QGridLayout( infoGroup );
		infoGroupLayout->setAlignment( Qt::AlignTop );
		infoGroupLayout->setSpacing( 2 );
		infoGroupLayout->setMargin( 0 );
		if (currItem->createInfoGroup(infoGroup, infoGroupLayout)) 
		{
			int row = infoGroupLayout->rowCount(); // <a.l.e>
	
			QLabel *printCT = new QLabel(infoGroup);
			QLabel *printT = new QLabel(infoGroup);
			printCT->setText( tr("Print: "));
			infoGroupLayout->addWidget( printCT, row, 0, Qt::AlignRight );
			if (currItem->printEnabled())
				printT->setText( tr("Enabled"));
			else
				printT->setText( tr("Disabled"));
			infoGroupLayout->addWidget( printT, row, 1 ); // </a.l.e>
					
			QWidgetAction* MenAct = new QWidgetAction(this);
			MenAct->setDefaultWidget(infoGroup);
			menuInfo->addAction(MenAct);
	
	// Qt4				menuInfo->insertItem(infoGroup);
//			currItem->createContextMenu(menuInfo, 5);
			QAction *act = addMenu(menuInfo);
			act->setText( tr("In&fo"));
		}
		else
		{
			delete infoGroupLayout;
			delete infoGroup;
		}
	}
	//-->

	//<-- Add Contents Actions
	if (m_actionList.contains("fileImportText"))
	{
		addSeparator();
		menuEditContent->addAction(m_ScMW->scrActions["fileImportText"]);
		menuEditContent->addAction(m_ScMW->scrActions["fileImportAppendText"]);
		menuEditContent->addAction(m_ScMW->scrActions["toolsEditWithStoryEditor"]);
		menuEditContent->addAction(m_ScMW->scrActions["insertSampleText"]);
		menuEditContent->addSeparator();
	}
	else //enable this for, eg, text on a path
		if (m_actionList.contains("toolsEditWithStoryEditor"))
		{
			addSeparator();
			menuEditContent->addAction(m_ScMW->scrActions["toolsEditWithStoryEditor"]);
		}
	if (m_actionList.contains("fileImportImage"))
		menuEditContent->addAction(m_ScMW->scrActions["fileImportImage"]);
	if (selectedItemCount==1 && currItem->asImageFrame())
	{
		if (QApplication::clipboard()->mimeData()->hasImage())
			menuEditContent->addAction(m_ScMW->scrActions["editPasteImageFromClipboard"]);
	}
	if (itemsAreSameType)
	{
		if (m_actionList.contains("editCopyContents"))
			menuEditContent->addAction(m_ScMW->scrActions["editCopyContents"]);
		if (m_actionList.contains("editPasteContents"))
			menuEditContent->addAction(m_ScMW->scrActions["editPasteContents"]);
		if (currItem->asImageFrame() && m_actionList.contains("editPasteContentsAbs"))
			menuEditContent->addAction(m_ScMW->scrActions["editPasteContentsAbs"]);
	}
	if (m_actionList.contains("editClearContents"))
		menuEditContent->addAction(m_ScMW->scrActions["editClearContents"]);
	if (m_actionList.contains("editTruncateContents"))
		menuEditContent->addAction(m_ScMW->scrActions["editTruncateContents"]);
	if (menuEditContent->actions().count()>0)
	{
		QAction *act = addMenu(menuEditContent);
		act->setText( tr("Content"));
	}
	//-->

	//<-- Item specific actions
	if (itemsAreSameType)
	{
		if (m_actionList.contains("editEditRenderSource"))
		{
			addSeparator();
#ifdef HAVE_OSG
			if (currItem->isOSGFrame())
			{
				QAction *act = addAction( tr("Edit 3D Annotation..."));
				connect(act, SIGNAL(triggered()), m_ScMW, SLOT(callImageEditor()));
			}
			else
				addAction(m_ScMW->scrActions["editEditRenderSource"]);
#else
			addAction(m_ScMW->scrActions["editEditRenderSource"]);
#endif
		}
		if (m_doc->appMode == modeEdit)
		{
			//add actions for marks in edit mode
			addSeparator();
			QAction *act2 = addMenu(menuMark);
			act2->setText( tr("Insert Mark"));
			menuMark->addAction(m_ScMW->scrActions["insertMarkVariableText"]);
			if (m_actionList.contains("insertMarkAnchor"))
			{
				menuMark->addAction(m_ScMW->scrActions["insertMarkAnchor"]);
				menuMark->addAction(m_ScMW->scrActions["insertMarkItem"]);
				menuMark->addAction(m_ScMW->scrActions["insertMark2Mark"]);
				if (!currItem->isNoteFrame())
					menuMark->addAction(m_ScMW->scrActions["insertMarkNote"]);
				//	menuMark->addAction(m_AP->scrActions["insertMarkIndex"]);
			}
			if (currItem->itemText.cursorPosition() < currItem->itemText.length())
			{
				if (currItem->itemText.hasMark(currItem->itemText.cursorPosition()))
					addAction(m_ScMW->scrActions["editMark"]);
			}
		}
		if (!m_doc->marksList().isEmpty())
		{
			addSeparator();
			addAction(m_ScMW->scrActions["itemUpdateMarks"]);
		}





		addSeparator();



		if (m_actionList.contains("tableInsertRows"))
			addAction(m_ScMW->scrActions["tableInsertRows"]);
		if (m_actionList.contains("tableInsertColumns"))
			addAction(m_ScMW->scrActions["tableInsertColumns"]);
		if (m_actionList.contains("tableDeleteRows"))
			addAction(m_ScMW->scrActions["tableDeleteRows"]);
		if (m_actionList.contains("tableDeleteColumns"))
			addAction(m_ScMW->scrActions["tableDeleteColumns"]);
		if (m_actionList.contains("tableMergeCells"))
			addAction(m_ScMW->scrActions["tableMergeCells"]);
		if (m_actionList.contains("tableSplitCells"))
			addAction(m_ScMW->scrActions["tableSplitCells"]);
		if (m_actionList.contains("tableSetRowHeights"))
			addAction(m_ScMW->scrActions["tableSetRowHeights"]);
		if (m_actionList.contains("tableSetColumnWidths"))
			addAction(m_ScMW->scrActions["tableSetColumnWidths"]);
		if (m_actionList.contains("tableDistributeRowsEvenly"))
			addAction(m_ScMW->scrActions["tableDistributeRowsEvenly"]);
		if (m_actionList.contains("tableDistributeColumnsEvenly"))
			addAction(m_ScMW->scrActions["tableDistributeColumnsEvenly"]);
		if (m_actionList.contains("tableAdjustFrameToTable"))
			addAction(m_ScMW->scrActions["tableAdjustFrameToTable"]);
		if (m_actionList.contains("tableAdjustTableToFrame"))
			addAction(m_ScMW->scrActions["tableAdjustTableToFrame"]);
		if (m_actionList.contains("itemAdjustFrameHeightToText"))
			addAction(m_ScMW->scrActions["itemAdjustFrameHeightToText"]);

		
		if (m_actionList.contains("itemPreviewLow"))
		{
			if (m_actionList.contains("itemImageIsVisible"))
				menuResolution->addAction(m_ScMW->scrActions["itemImageIsVisible"]);
			menuResolution->addSeparator();
			if (m_actionList.contains("itemPreviewFull"))
				menuResolution->addAction(m_ScMW->scrActions["itemPreviewFull"]);
			if (m_actionList.contains("itemPreviewNormal"))
				menuResolution->addAction(m_ScMW->scrActions["itemPreviewNormal"]);
			if (m_actionList.contains("itemPreviewLow"))
				menuResolution->addAction(m_ScMW->scrActions["itemPreviewLow"]);
			if (menuResolution->actions().count()>0)
			{
				QAction *act = addMenu(menuResolution);
				act->setText( tr("Preview Settings"));
			}
		}
		
		if (m_actionList.contains("styleImageEffects"))
			menuImage->addAction(m_ScMW->scrActions["styleImageEffects"]);
		if (m_actionList.contains("editEditWithImageEditor"))
			menuImage->addAction(m_ScMW->scrActions["editEditWithImageEditor"]);
		if (selectedItemCount==1 && currItem->asImageFrame())
		{
			if (currItem->imageIsAvailable)
			{
				if (m_actionList.contains("itemExtendedImageProperties"))
					menuImage->addAction(m_ScMW->scrActions["itemExtendedImageProperties"]);
				if (m_actionList.contains("itemAdjustFrameToImage"))
				{
					if (currItem->imageIsAvailable)
						menuImage->addAction(m_ScMW->scrActions["itemToggleInlineImage"]);
				}
				if (m_actionList.contains("itemImageInfo"))
					menuImage->addAction(m_ScMW->scrActions["itemImageInfo"]);
				if (m_actionList.contains("itemUpdateImage"))
					menuImage->addAction(m_ScMW->scrActions["itemUpdateImage"]);
				if (m_actionList.contains("itemAdjustFrameToImage"))
					menuImage->addAction(m_ScMW->scrActions["itemAdjustFrameToImage"]);
				if (m_actionList.contains("itemAdjustImageToFrame"))
					menuImage->addAction(m_ScMW->scrActions["itemAdjustImageToFrame"]);
				m_ScMW->scrActions["itemAdjustFrameToImage"]->setEnabled(true);
				m_ScMW->scrActions["itemAdjustImageToFrame"]->setEnabled(true);
				if (currItem->pixm.imgInfo.valid)
					m_ScMW->scrActions["itemExtendedImageProperties"]->setEnabled(true);
				if (currItem->pixm.imgInfo.exifDataValid)
					m_ScMW->scrActions["itemImageInfo"]->setEnabled(true);
				m_ScMW->scrActions["itemUpdateImage"]->setEnabled(true);
				if (currItem->isRaster)
				{
					m_ScMW->scrActions["styleImageEffects"]->setEnabled(true);
					m_ScMW->scrActions["editEditWithImageEditor"]->setEnabled(true);
				}


				if (menuImage->actions().count()>0)
				{
					QAction *act = addMenu(menuImage);
					act->setText( tr("Image"));
				}
			}
		}
		
		if ((selectedItemCount==1) && currItem->asTextFrame())
		{
			if (currItem->itemText.length() > 0)
				m_ScMW->scrActions["itemAdjustFrameHeightToText"]->setEnabled(true);
		}
	}
	//-->




	addSeparator();

	
	if (selectedItemCount>0)
	{
		//<-- Item Locking
		menuLocking->addAction(m_ScMW->scrActions["itemLock"]);
		menuLocking->addAction(m_ScMW->scrActions["itemLockSize"]);
		QAction *actL = addMenu(menuLocking);
		actL->setText( tr("Locking"));
		//-->

		//<-- Send To
		QAction *actST = addMenu(menuSendTo);
		actST->setText( tr("Send to"));
		QAction *actScr = menuSendTo->addMenu(menuScrapbook);
		actScr->setText( tr("Scrapbook"));
		menuSendTo->addAction(m_ScMW->scrActions["itemSendToPattern"]);
		menuSendTo->addAction(m_ScMW->scrActions["itemSendToInline"]);

		QStringList scrapNames = m_ScMW->scrapbookNames();
		scrapNames.removeAt(1);
		for (int i = 0; i < scrapNames.count(); i++)
		{
			ScrAction *act = new ScrAction( ScrAction::DataInt, QPixmap(), QPixmap(), scrapNames[i], QKeySequence(), this, i);
			menuScrapbook->addAction(act);
			connect(act, SIGNAL(triggeredData(int)), m_ScMW, SLOT(PutScrap(int)));
		}

		if (m_doc->layerCount() > 1)
		{
			QMap<int,int> layerMap;
			for (ScLayers::iterator it = m_doc->Layers.begin(); it != m_doc->Layers.end(); ++it)
				layerMap.insert((*it).Level, (*it).ID);
			int i=layerMap.count()-1;
			while (i>=0)
			{
				if (m_doc->layerLocked(layerMap[i]))
					m_ScMW->scrLayersActions[QString::number(layerMap[i])]->setEnabled(false);
				else
					m_ScMW->scrLayersActions[QString::number(layerMap[i])]->setEnabled(true);
				QPixmap pm(20,15);
				pm.fill(m_doc->layerMarker(layerMap[i]));
				m_ScMW->scrLayersActions[QString::number(layerMap[i])]->setIcon(pm);
				menuLayer->addAction(m_ScMW->scrLayersActions[QString::number(layerMap[i--])]);
			}
			QAction *act = addMenu(menuLayer);
			act->setText( tr("Send to La&yer"));
		}
		//-->
	}


	//<-- Add Groups Items
	if (selectedItemCount > 1)
	{
		if (m_Sel.objectsLayer() != -1)
			addAction(m_ScMW->scrActions["itemGroup"]);
	}
	else
	{
		if (currItem->isGroup())
		{
			addAction(m_ScMW->scrActions["itemUngroup"]);
			addAction(m_ScMW->scrActions["itemGroupAdjust"]);
		}
	}
	//-->

	//<-- Add Level Items
	if (!currItem->locked())
	{
		menuLevel->addAction(m_ScMW->scrActions["itemRaise"]);
		menuLevel->addAction(m_ScMW->scrActions["itemLower"]);
		menuLevel->addAction(m_ScMW->scrActions["itemRaiseToTop"]);
		menuLevel->addAction(m_ScMW->scrActions["itemLowerToBottom"]);
		if (menuLevel->actions().count()>0)
		{
			QAction *act = addMenu(menuLevel);
			act->setText( tr("Le&vel"));
		}
	}
	//-->
	
	//<-- Add Convert To Items
	if (m_doc->appMode != modeEdit && (itemsAreSameType || currItem->isSingleSel)) //Create convertTo Menu
	{
		if (m_ScMW->scrActions["itemConvertToBezierCurve"]->isEnabled() && m_actionList.contains("itemConvertToBezierCurve"))
			menuConvertTo->addAction(m_ScMW->scrActions["itemConvertToBezierCurve"]);
		if (m_ScMW->scrActions["itemConvertToImageFrame"]->isEnabled() && m_actionList.contains("itemConvertToImageFrame"))
			menuConvertTo->addAction(m_ScMW->scrActions["itemConvertToImageFrame"]);
		if (m_ScMW->scrActions["itemConvertToOutlines"]->isEnabled() && m_actionList.contains("itemConvertToOutlines"))
			menuConvertTo->addAction(m_ScMW->scrActions["itemConvertToOutlines"]);
		if (m_ScMW->scrActions["itemConvertToPolygon"]->isEnabled() && m_actionList.contains("itemConvertToPolygon"))
			menuConvertTo->addAction(m_ScMW->scrActions["itemConvertToPolygon"]);
		if (m_ScMW->scrActions["itemConvertToTextFrame"]->isEnabled() && m_actionList.contains("itemConvertToTextFrame"))
			menuConvertTo->addAction(m_ScMW->scrActions["itemConvertToTextFrame"]);
		if (m_ScMW->scrActions["itemConvertToSymbolFrame"]->isEnabled() && !currItem->isSymbol())
			menuConvertTo->addAction(m_ScMW->scrActions["itemConvertToSymbolFrame"]);
		if (menuConvertTo->actions().count()>0)
		{
			QAction *act = addMenu(menuConvertTo);
			act->setText( tr("Conve&rt to"));
		}
	}
	//-->
	//<-- Item Attributes
	if (selectedItemCount == 1)
	{
		addSeparator();
		addAction(m_ScMW->scrActions["itemAttributes"]);
	}
	//-->

	//<-- Item PDF Options
	if (currItem->itemType() == PageItem::TextFrame)
	{
		QAction *act = addMenu(menuPDF);
		act->setText( tr("&PDF Options"));
		menuPDF->addAction(m_ScMW->scrActions["itemPDFIsAnnotation"]);
		if (!m_doc->masterPageMode())
			menuPDF->addAction(m_ScMW->scrActions["itemPDFIsBookmark"]);
		if (selectedItemCount == 1)
		{
			menuPDF->addSeparator();
			if (m_actionList.contains("itemPDFAnnotationProps"))
				menuPDF->addAction(m_ScMW->scrActions["itemPDFAnnotationProps"]);
			if (m_actionList.contains("itemPDFFieldProps"))
				menuPDF->addAction(m_ScMW->scrActions["itemPDFFieldProps"]);
		}
	}
	//-->
	//<<-- Edit Menu
	addSeparator();
	//<-- Add Copy/Paste Actions
	if (!currItem->locked() && !(currItem->isSingleSel))
		menuEdit->addAction(m_ScMW->scrActions["editCut"]);
	if (!(currItem->isSingleSel))
		menuEdit->addAction(m_ScMW->scrActions["editCopy"]);
	if (((m_doc->appMode == modeEdit && currItem->itemType() == PageItem::TextFrame) || (m_doc->appMode == modeEditTable && currItem->itemType() == PageItem::Table)) && (ScMimeData::clipboardHasScribusText()||ScMimeData::clipboardHasPlainText()) )
		menuEdit->addAction(m_ScMW->scrActions["editPaste"]);
	if (!currItem->locked() && (m_doc->appMode != modeEdit)  && (m_doc->appMode != modeEditTable) && (!(currItem->isSingleSel)))
		menuEdit->addAction(m_ScMW->scrActions["itemDelete"]);
	//-->
	//<-- Add undo
	UndoManager * const undoManager(UndoManager::instance());
	if (undoManager->hasUndoActions())
		menuEdit->addAction(m_ScMW->scrActions["editUndoAction"]);
	if (undoManager->hasRedoActions())
		menuEdit->addAction(m_ScMW->scrActions["editRedoAction"]);
	QAction *actEdit = addMenu(menuEdit);
	actEdit->setText( tr("Edit"));
	//-->
	//-->
	
	//<-- Add Welding Menu
	addSeparator();
	if (selectedItemCount > 0 && m_doc->appMode != modeEdit)
	{
		PageItem *currItem;
		for (int a = 0; a < m_Sel.count(); ++a)
		{
			currItem = m_Sel.itemAt(a);
			if (currItem->isWelded())
			{
				addAction(m_ScMW->scrActions["itemsUnWeld"]);
				break;
			}
		}
	}
	if (selectedItemCount == 2 && m_doc->appMode != modeEdit)
		addAction(m_ScMW->scrActions["itemWeld"]);
//	{
//		menuWeld->addAction(m_AP->scrActions["itemWeld17"]);
//		menuWeld->addAction(m_AP->scrActions["itemWeld71"]);
//		menuWeld->addAction(m_AP->scrActions["itemWeld13"]);
//		menuWeld->addAction(m_AP->scrActions["itemWeld31"]);
//		QAction *act = addMenu(menuWeld);
//		act->setText( tr("Weld to last..."));
//	}
	//-->
	
	//<-- Add Properties
	addSeparator();
	addAction(m_ScMW->scrActions["toolsProperties"]);
	//-->

}
コード例 #10
0
void MainWindow::showRoomGrid()
{
    if(0!=Grid || 0!=scroll || 0!=layout)
    {
        delete Grid;
        delete scroll;
        delete layout;
    }
    layout = new QVBoxLayout();
    scroll = new QScrollArea(this);
    Grid = new QGridLayout(this);

    Grid->setHorizontalSpacing(6);
    Grid->setVerticalSpacing(6);
    scroll->setLayout(Grid);
    layout->addWidget(scroll);

    ui->Tabs2->widget(0)->setLayout(layout);
    vector<Room> Room;
    QString RoomNumTitle,RoomFloor;

    Room = RM.fetchAllRooms();

    int RoomSize=Room.size();
    int i=0,j=0;
    int num=0,RoomNum=0;

    while(num!=RoomSize)
    {
        QLabel * RoomLabel = new QLabel(this);
        RoomLabel->setGeometry(0,0,310,180);
        RoomLabel->setFrameShape(QFrame::Box);
        RoomLabel->setFrameShadow(QFrame::Sunken);
        RoomLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
        RoomLabel->setFont(QFont( "Comic Sans MS", 8, QFont::Bold ));
        //-----------------------------------------------------------
        RoomNumTitle.setNum(Room[RoomNum].getRoomNumber());
        RoomFloor.setNum(Room[RoomNum].getRoomFloor());
        RoomLabel->setObjectName(RoomNumTitle);
        RoomLabel->setText("Num:"+RoomNumTitle+"\n Floor:"+RoomFloor);
        //-----------------------------------------------------------
        if(RM.getStatus(Room[RoomNum].getRoomNumber(),QDate::currentDate(),QDate::currentDate())==false)
            RoomLabel->setStyleSheet("color: white; background-color:green;");
        else
            RoomLabel->setStyleSheet("color: white; background-color:red;");
        //-----------------------------------------------------------
        RoomLabel->installEventFilter(this);
        Grid->addWidget(RoomLabel,i,j);
        num++;
        if(j<5)
        {
            j++;
        }
        else
        {
            j=0;
            i++;
        }
        RoomNum++;
    }
}
コード例 #11
0
StaticFrameGui::StaticFrameGui(QWidget* parent): FrameGui(parent)
{

    setTitle("Static Frame");

    group = new QButtonGroup (this);
    grid = new QGridLayout (this);

    dewellSwitch = new QRadioButton (this);
    dewellSwitch->setText("Dewell (ms)");
    dewellSwitch->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    repeatSwitch = new QRadioButton (this);
    repeatSwitch->setText("Repeat (frames)");
    repeatSwitch->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);

    group->addButton(dewellSwitch,1);
    group->addButton(repeatSwitch,2);

    grid->addWidget(dewellSwitch,2,0,1,1);
    grid->addWidget(repeatSwitch,3,0,1,1);

    QLabel * pointsLabel = new QLabel ("Points",this);
    pointsLabel->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    pointsDisplay = new QLabel ("0",this);
    pointsDisplay->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    grid->addWidget(pointsLabel,1,0,1,1);
    grid->addWidget(pointsDisplay,1,1,1,1);

    dewellEntry = new QSpinBox (this);
    dewellEntry->setMinimum (40);
    dewellEntry->setMaximum (600000);

    repeatEntry = new QSpinBox (this);
    repeatEntry->setMinimum (1);
    repeatEntry->setMaximum (1000);

    grid->addWidget(dewellEntry,2,1,1,1);
    grid->addWidget(repeatEntry,3,1,1,1);
    QLabel *l = new QLabel (this);
    l->setText("ArcBall");
    l->setFrameShape(QFrame::Panel);
    l->setFrameShadow(QFrame::Raised);
    l->setAlignment(Qt::AlignHCenter);
    arcball = new ArcBall(this);
    connect (arcball,SIGNAL(angleChanged(QQuaternion)),this,SLOT(angleChangedData(QQuaternion)));
    connect (arcball,SIGNAL(mouseDown()),this,SLOT(arcballDown()));
    connect (arcball,SIGNAL(mouseUp()),this,SLOT(arcballUp()));
    grid->addWidget(l,4,0);
    grid->addWidget(arcball,5,0);
    l = new QLabel (this);
    l->setText ("Size");
    l->setFrameShape(QFrame::Panel);
    l->setFrameShadow(QFrame::Raised);
    l->setAlignment(Qt::AlignHCenter);
    grid->addWidget(l,4,1);
    size = new QSlider(Qt::Vertical,this);
    size->setRange(-200,100);
    size->setSliderPosition(0);
    grid->addWidget(size,5,1);
    setLayout(grid);
}
コード例 #12
0
void KPrWebPresentationWizard::setupPage2()
{
    page2 = new QHBox( this );
    QWhatsThis::add( page2, i18n("This page allows you to specify how the HTML "
                                 "for your presentation will be displayed. Select "
                                 "individual items for more help on what they do.") );
    page2->setSpacing( KDialog::spacingHint() );
    page2->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page2 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page2 );
    QGridLayout *layout = new QGridLayout( canvas, 6, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft );
    QString help = i18n("Here you can configure the style of the web pages.");
    help += i18n( "You can also specify the zoom for the slides." );
    helptext->setText(help);

    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 50 ), 1, 1, 0, 1 );

    QLabel *label1 = new QLabel( i18n("Zoom:"), canvas );
    label1->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label1, i18n( "This selection allows you to specify "
                                   "the size of the slide image." ) );
    layout->addWidget( label1, 2, 0 );

    QLabel *label2 = new QLabel( i18n( "Encoding:" ), canvas );
    label2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );

    layout->addWidget( label2, 3, 0 );

    QLabel *label3 = new QLabel( i18n( "Document type:" ), canvas );
    label3->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label3, 4, 0 );

    zoom = new KIntNumInput( webPres.getZoom(), canvas );
    QWhatsThis::add( zoom, i18n( "This selection allows you to specify "
                                 "the size of the slide image." ) );
    layout->addWidget( zoom, 2, 1 );
    zoom->setSuffix( " %" );
    zoom->setRange( 25, 1000, 5 );

    encoding = new KComboBox( false, canvas );
    layout->addWidget( encoding, 3, 1 );

    // Fill encoding combo
    // Stolen from kdelibs/kate/part/katedialogs.cpp
    QStringList encodings(KGlobal::charsets()->descriptiveEncodingNames());
    int idx = 0;
    for (uint i = 0; i < encodings.count(); i++)
    {
      bool found = false;
      QTextCodec *codecForEnc = KGlobal::charsets()->codecForName(KGlobal::charsets()->encodingForName(encodings[i]), found);
      if (found)
      {
        encoding->insertItem(encodings[i]);

        if ( codecForEnc->name() == webPres.getEncoding() )
          encoding->setCurrentItem(idx);
        idx++;
      }
    }

    doctype = new KComboBox( false, canvas );
    layout->addWidget( doctype, 4, 1 );
    doctype->insertItem( "HTML 4.01", -1 );
    doctype->insertItem( "XHTML 1.0", -1 );

    doctype->setCurrentItem( webPres.isXML() ? 1 : 0 );

    QSpacerItem* spacer = new QSpacerItem( 1, 10,
                                           QSizePolicy::Minimum, QSizePolicy::Expanding );
    layout->addMultiCell( spacer, 5, 5, 0, 1 );

    addPage( page2, i18n( "Step 2: Configure HTML" ) );

    setHelpEnabled(page2, false);  //doesn't do anything currently
}
コード例 #13
0
ファイル: downloadwidget.cpp プロジェクト: kyak/nanomap
DownloadWidget::DownloadWidget(QWidget *parent)
    : QWidget(parent),
    m_manager(new QNetworkAccessManager(this)),
    m_downloadMode(Tiles),
    m_tabWidget(new QTabWidget(this)),
    m_dlProgress(new QProgressBar(this)),
    m_startButton(new QPushButton("&Start download", this)),
    m_backButton(new QPushButton("&Back", this)),
    m_startLevel(0),
    m_dlRect(),
    m_dlList(),
    m_currentDownload(0),
    m_prefix("OSM"),
    m_up(new QLabel("N 0", this)),
    m_left(new QLabel("E 0", this)),
    m_right(new QLabel("E 0", this)),
    m_bottom(new QLabel("N 0", this)),
    m_levelSpinBox(new QSpinBox(this)),
    m_prefixInput(new QLineEdit(this)),
    m_skipExisting(new QCheckBox("S&kip already downloaded tiles", this)),
    m_poiTypes(new QListWidget(this)),
    m_makePOILayer(new QCheckBox("&Load file after download", this)),
    m_destFilename(new QLineEdit(QDir::homePath()+"/pois.osm", this)),
    m_packageList(new QListWidget(this)),
    m_destDir(new QLineEdit(QDir::homePath(), this))
{
    QGridLayout *layout = new QGridLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setRowStretch(0, 1);

    layout->addWidget(m_tabWidget, 0, 0, 1, 2);

    m_dlProgress->hide();
    layout->addWidget(m_dlProgress, 1, 0, 1, 2);

    m_startButton->setIcon(QIcon(":ok.png"));
    connect(m_startButton, SIGNAL(clicked()), this, SLOT(startDownload()));
    layout->addWidget(m_startButton, 2, 0);

    m_backButton->setIcon(QIcon(":cancel.png"));
    connect(m_backButton, SIGNAL(clicked()), this, SIGNAL(back()));
    layout->addWidget(m_backButton, 2, 1);

    QWidget *widget = new QWidget(this);
    layout = new QGridLayout(widget);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setRowStretch(1, 1);

    m_up->setAlignment(Qt::AlignHCenter);
    m_left->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    m_right->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_bottom->setAlignment(Qt::AlignHCenter);
    layout->addWidget(m_up, 0, 0, 1, 4);
    layout->addWidget(m_left, 1, 0);
    layout->addWidget(m_right, 1, 3);
    layout->addWidget(m_bottom, 2, 0, 1, 4);

    QLabel *label = new QLabel(this);
    label->setFrameShape(QLabel::Box);
    layout->addWidget(label, 1, 1, 1, 2);

    label = new QLabel("Download up to level:", this);
    layout->addWidget(label, 3, 0, 1, 2);

    m_levelSpinBox->setRange(0, 18);
    layout->addWidget(m_levelSpinBox, 3, 2, 1, 2);

    label = new QLabel("Download into directory:", this);
    layout->addWidget(label, 4, 0, 1, 2);

    m_prefixInput->setText(m_prefix);
    layout->addWidget(m_prefixInput, 4, 2, 1, 2);

    m_skipExisting->setChecked(false);
    layout->addWidget(m_skipExisting, 5, 0, 1, 0);

    m_tabWidget->addTab(widget, "&Tiles");

    widget = new QWidget(this);
    layout = new QGridLayout(widget);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setRowStretch(0, 1);

    QSettings set(QDir::homePath()+"/Maps/nanomap.conf", QSettings::NativeFormat);
    set.beginGroup("poi");
    QString iconPath = set.value("iconpath", "/usr/share/NanoMap/icons").toString();
    set.endGroup();
    QDir iconDir(iconPath);
    QStringList icons = iconDir.entryList(QStringList() << "*.png");
    foreach (const QString &icon, icons) {
        QString name = icon;
        name.remove(".png");
        QListWidgetItem *item = new QListWidgetItem(QIcon(iconPath+"/"+icon), name);
        m_poiTypes->addItem(item);
    }
コード例 #14
0
WidgetImage::WidgetImage(QWidget *parent) : QWidget(parent), toolbar(0),
  statusbar(0), paintWnd(0), scrollArea(0), zoomBox(0) {
  toolbar = new QToolBar(tr("Image"),this);
  statusbar = new QStatusBar(this);
  paintWnd = new PaintWidget();
  scrollArea = new QScrollArea(this);
  scrollArea->setWidget(paintWnd);
  scrollArea->setWidgetResizable(true);

  QAction* action = new QAction(QIcon(":/icons/resources/save.png"),tr("Save Image"),toolbar);
  connect(action,SIGNAL(triggered()),paintWnd,SLOT(saveImage()));
  toolbar->addAction(action);
  toolbar->addSeparator();
  action = new QAction(QIcon(":/icons/resources/arrow_in.png"),tr("Fit to Window"),toolbar);
  action->setCheckable(true);
  action->setChecked(true);
  connect(action,SIGNAL(triggered(bool)),this,SLOT(toggleFitToWindow(bool)));
  connect(action,SIGNAL(triggered(bool)),paintWnd,SLOT(toggleFitToWindow(bool)));
  toolbar->addAction(action);
  action = new QAction(QIcon(":/icons/resources/zoom_100.png"),tr("Zoom 100%"),toolbar);
  action->setEnabled(false);
  connect(action,SIGNAL(triggered()),paintWnd,SLOT(zoomImage100()));
  toolbar->addAction(action);
  zoomBox = new QSpinBox(toolbar);
  zoomBox->setToolTip(tr("Zoom Image"));
  zoomBox->setRange(0,999);
  zoomBox->setSingleStep(10);
  zoomBox->setSuffix("%");
  zoomBox->setButtonSymbols(QAbstractSpinBox::PlusMinus);
  zoomBox->setEnabled(false);
  connect(zoomBox,SIGNAL(valueChanged(int)),paintWnd,SLOT(zoomImage(int)));
  connect(paintWnd,SIGNAL(setZoom(int)),zoomBox,SLOT(setValue(int)));
  toolbar->addWidget(zoomBox);

  QLabel* typeLabel = new QLabel(statusbar);
  typeLabel->setTextFormat(Qt::PlainText);
  typeLabel->setTextInteractionFlags(Qt::NoTextInteraction);
  typeLabel->setFrameShadow(QFrame::Sunken);
  statusbar->addPermanentWidget(typeLabel);
  QLabel* sizeLabel = new QLabel(statusbar);
  sizeLabel->setTextFormat(Qt::PlainText);
  sizeLabel->setTextInteractionFlags(Qt::NoTextInteraction);
  sizeLabel->setFrameShadow(QFrame::Sunken);
  statusbar->addPermanentWidget(sizeLabel);
  QLabel* posLabel = new QLabel(statusbar);
  posLabel->setTextFormat(Qt::PlainText);
  posLabel->setTextInteractionFlags(Qt::NoTextInteraction);
  posLabel->setFrameShape(QFrame::NoFrame);
  statusbar->addWidget(posLabel,1);
  connect(paintWnd,SIGNAL(setStatusMsg(QString,int)),statusbar,SLOT(showMessage(QString,int)),Qt::QueuedConnection);
  connect(paintWnd,SIGNAL(printImageSize(QString)),sizeLabel,SLOT(setText(QString)),Qt::QueuedConnection);
  connect(paintWnd,SIGNAL(printImageType(QString)),typeLabel,SLOT(setText(QString)),Qt::QueuedConnection);
  connect(paintWnd,SIGNAL(printImagePos(QString)),posLabel,SLOT(setText(QString)),Qt::QueuedConnection);

  QVBoxLayout* layout = new QVBoxLayout();
  layout->addWidget(toolbar);
  layout->addWidget(scrollArea,1);
  layout->addWidget(statusbar);
  layout->setSpacing(0);
  layout->setContentsMargins(0,0,0,0);
  setLayout(layout);
}
コード例 #15
0
void KPrWebPresentationWizard::setupPage5()
{
    page5 = new QHBox( this );
    QWhatsThis::add( page5, i18n("This page allows you to specify some options for "
                                 "presentations which run unattended, such as time "
                                 "elapsed before advancing to the next slide, looping "
                                 "and the presence of headers. If you do not want "
                                 "an unattended presentation, just leave defaults unchanged.") );
    page5->setSpacing( KDialog::spacingHint() );
    page5->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page5 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page5 );
    QGridLayout *layout = new QGridLayout( canvas, 6, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft );
    QString help = i18n("Here you can configure some options for unattended "
                        "presentations, such as time elapsed before automatically advance to "
                        "the next slide, looping and the presence of headers.");
    helptext->setText(help);

    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 50 ), 1, 1, 0, 1 );

    QLabel *label1 = new QLabel( i18n("Advance after:"), canvas );
    label1->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label1, i18n( "This selection allows you to specify "
                                   "the time between slides." ) );
    layout->addWidget( label1, 2, 0 );

    timeBetweenSlides = new KIntNumInput( webPres.getTimeBetweenSlides(), canvas );
    timeBetweenSlides->setSpecialValueText(i18n( "Disabled" ));
    QWhatsThis::add( timeBetweenSlides, i18n( "This selection allows you to specify "
                                 "the time between slides." ) );
    layout->addWidget( timeBetweenSlides, 2, 1 );
    timeBetweenSlides->setSuffix( " seconds" );
    timeBetweenSlides->setRange( 0, 900, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 10 ), 1, 1, 0, 1 );

    writeHeader=new QCheckBox( i18n("Write header to the slides"), canvas);
    QWhatsThis::add( writeHeader, i18n( "This checkbox allows you to specify if you "
                                       "want to write the navigation buttons on top "
                                       "of the slide." ) );
    writeHeader->setChecked( webPres.wantHeader() );
    layout->addWidget( writeHeader, 3, 1);

    writeFooter=new QCheckBox( i18n("Write footer to the slides"), canvas);
    QWhatsThis::add( writeFooter, i18n( "This checkbox allows you to specify if you "
                                       "want to write an imprint consisting on the author "
                                       "and the software used to create these slides." ) );
    writeFooter->setChecked( webPres.wantFooter() );
    layout->addWidget( writeFooter, 4, 1);

    loopSlides=new QCheckBox( i18n("Loop presentation"), canvas);
    QWhatsThis::add( loopSlides, i18n( "This checkbox allows you to specify if you "
                                       "want the presentation to start again once "
                                       "the latest slide is reached." ) );
    loopSlides->setChecked( webPres.wantLoopSlides() );
    layout->addWidget( loopSlides, 5, 1);

    QSpacerItem* spacer = new QSpacerItem( 1, 10,
                                           QSizePolicy::Minimum, QSizePolicy::Expanding );
    layout->addMultiCell( spacer, 5, 5, 0, 1 );

    addPage( page5, i18n( "Step 5: Options for Unattended Presentations" ) );

    setHelpEnabled(page5, false);  //doesn't do anything currently

    setFinish( page5, true );
}
コード例 #16
0
void KPrWebPresentationWizard::setupPage4()
{
    page4 = new QHBox( this );
    QWhatsThis::add( page4, i18n("This page allows you to modify the titles of "
                                 "each slide, if required. You normally do not need "
                                 "to do this, but it is available if required.") );
    page4->setSpacing( KDialog::spacingHint() );
    page4->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page4 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page4 );
    QGridLayout *layout = new QGridLayout( canvas, 3, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft );
    helptext->setText( i18n( "Here you can specify titles for "
                             "each slide. Click on a slide in "
                             "the list and then enter the title "
                             "in the textbox below. If you "
                             "click on a title, KPresenter "
                             "mainview will display the slide.") );

    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    QLabel *label = new QLabel( i18n( "Slide title:" ), canvas );
    label->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label, 1, 0 );

    slideTitle = new KLineEdit( canvas );
    layout->addWidget( slideTitle, 1, 1 );
    connect( slideTitle, SIGNAL( textChanged( const QString & ) ), this,
             SLOT( slideTitleChanged( const QString & ) ) );

    slideTitles = new KListView( canvas );
    layout->addMultiCellWidget( slideTitles, 2, 2, 0, 1 );
    slideTitles->addColumn( i18n( "No." ) );
    slideTitles->addColumn( i18n( "Slide Title" ) );
    connect( slideTitles, SIGNAL( selectionChanged( QListViewItem * ) ), this,
             SLOT( slideTitleChanged( QListViewItem * ) ) );
    slideTitles->setSorting( -1 );
    slideTitles->setAllColumnsShowFocus( true );
    slideTitles->setResizeMode( QListView::LastColumn );
    slideTitles->header()->setMovingEnabled( false );

    QValueList<KPrWebPresentation::SlideInfo> infos = webPres.getSlideInfos();
    for ( int i = infos.count() - 1; i >= 0; --i ) {
        KListViewItem *item = new KListViewItem( slideTitles );
        item->setText( 0, QString::number( i + 1 ) );
        //kdDebug(33001) << "KPrWebPresentationWizard::setupPage3 " << infos[ i ].slideTitle << endl;
        item->setText( 1, infos[ i ].slideTitle );
    }

    slideTitles->setSelected( slideTitles->firstChild(), true );

    addPage( page4, i18n( "Step 4: Customize Slide Titles" ) );

    setHelpEnabled(page4, false);  //doesn't do anything currently
}
コード例 #17
0
QWidget *DynamicConnectionPageWindow::createDynamicWidget(WidgetType widgetType, DynamicWidgetInfo *widgetInfo) const
{
    QWidget *widget = 0;
    QString value = getValue(widgetInfo->attributes.value("value"));

    switch(widgetType){
    case Label:
    {
        QLabel *label = new QLabel(value);
        label->setFrameShape(QFrame::StyledPanel);
        label->setFrameShadow(QFrame::Sunken);
        label->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
        widget = label;
        break;
    }
    case CheckBox:
    {
        QCheckBox *checkBox = new QCheckBox();
        checkBox->setChecked(value == "true");
        widget = checkBox;
        break;
    }
    case ComboBox:
    {
        QComboBox *comboBox = new QComboBox();
        QDomNodeList childNodes = widgetInfo->childNodes;
        for(int i=0; i<childNodes.size(); ++i){
            QDomNode e = childNodes.at(i);
            Q_ASSERT(e.nodeName() == "option");
            comboBox->addItem(e.attributes().namedItem("text").toAttr().value());
        }
        if(!value.isEmpty()){
            comboBox->setCurrentIndex(value.toInt());
        }

        widget = comboBox;
        break;
    }
    case RadioButton:
    {
        RadioButtonGroup *radioButtonGroup = new RadioButtonGroup(widgetInfo->attributes.value("caption").isEmpty() ? Qt::Horizontal : Qt::Vertical);
        QDomNodeList childNodes = widgetInfo->childNodes;
        for(int i=0; i<childNodes.size(); ++i){
            QDomNode e = childNodes.at(i);
            Q_ASSERT(e.nodeName() == "option");
            QString text = e.attributes().namedItem("text").toAttr().value();
            QRadioButton *radio = new QRadioButton(text);
            radioButtonGroup->addRadioButton(radio);
        }

        if(!value.isEmpty()){
            radioButtonGroup->checkRadio(value.toInt());
        }

        widget = radioButtonGroup;
        break;
    }
    default:
        Q_ASSERT(false);
        return 0;
        break;
    }

    QString widgetName = widgetInfo->attributes.value("name");
    widget->setObjectName(widgetName);

    return widget;
}
コード例 #18
0
ファイル: ActionZone.cpp プロジェクト: vhotspur/otterdict
void ActionZone::preferencesDialog() {
	QSettings settings("otter", "dict");
	
	QDialog * dialog = new QDialog();
	
	QPushButton * okButton = new QPushButton("OK", dialog);
	connect(okButton, SIGNAL(clicked()), dialog, SLOT(accept()));
	QPushButton * cancelButton = new QPushButton("Cancel", dialog);
	connect(cancelButton, SIGNAL(clicked()), dialog, SLOT(reject()));
	QBoxLayout * buttonLayout = new QHBoxLayout();
	buttonLayout->addWidget(okButton);
	buttonLayout->addWidget(cancelButton);
	
	QLabel * dictionaryCountLabel = new QLabel("Number of dictionaries", dialog);
	QComboBox * dictionaryCountCombo = new QComboBox(dialog);
	dictionaryCountCombo->addItem("1");
	dictionaryCountCombo->addItem("2");
	dictionaryCountCombo->addItem("3");
	dictionaryCountCombo->addItem("4");
	dictionaryCountCombo->addItem("5");
	dictionaryCountCombo->setCurrentIndex(resultViewers_.size() - 1);
	
	QLabel * pluginDirectoryLabel = new QLabel("Directory with plugins", dialog);
	QLineEdit * pluginDirectory = new QLineEdit(dialog);
	{
		QString directories;
		settings.beginGroup("application");
		int size = settings.beginReadArray("plugindirectory");
		for (int i = 0; i < size; i++) {
			settings.setArrayIndex(i);
			QString dir = settings.value("directory").toString();
			if (dir.isEmpty()) {
				continue;
			}
			directories += dir + ":";
		}
		pluginDirectory->setText(directories);
		settings.endArray();
		settings.endGroup();
	}
	
	
	QLabel * reloadInfoLabel = new QLabel(
		"OtterDict needs to be restarted to apply the changes.", dialog);
	reloadInfoLabel->setWordWrap(true);
	reloadInfoLabel->setFrameShape(QFrame::StyledPanel);
	
	QGridLayout * preferencesLayout = new QGridLayout(dialog);
	preferencesLayout->setSizeConstraint(QLayout::SetFixedSize);
	preferencesLayout->addWidget(dictionaryCountLabel, 0, 0, Qt::AlignRight);
	preferencesLayout->addWidget(dictionaryCountCombo, 0, 1, Qt::AlignLeft);
	preferencesLayout->addWidget(pluginDirectoryLabel, 1, 0, Qt::AlignRight);
	preferencesLayout->addWidget(pluginDirectory, 1, 1, Qt::AlignLeft);
	preferencesLayout->addWidget(reloadInfoLabel, 2, 0, 1, 2, Qt::AlignHCenter);
	preferencesLayout->addLayout(buttonLayout, 3, 0, 1, 2, Qt::AlignHCenter);
	
	dialog->setSizeGripEnabled(false);
	dialog->setWindowTitle("OtterDict preferences");
	
	QDialog::DialogCode retCode = (QDialog::DialogCode)dialog->exec();
	if (retCode == QDialog::Rejected) {
		return;
	}
	
	int dictionaryCount = dictionaryCountCombo->currentIndex() + 1;
	
	settings.setValue("mainwindow/dictionarycount", dictionaryCount);
	
	// Write the application settings.
	settings.beginGroup("application");
	
	// Write the plugin directories.
	{
		settings.beginWriteArray("plugindirectory");
		
		QStringList dirs = pluginDirectory->text().split(":", QString::SkipEmptyParts);
		QStringList::iterator e = dirs.end();
		int idx;
		QStringList::iterator i;
		for (idx = 0, i = dirs.begin(); i != e; ++i, idx++) {
			settings.setArrayIndex(idx);
			settings.setValue("directory", *i);
		}
		
		settings.endArray();
	}
	
	settings.endGroup();
}
コード例 #19
0
/// continue the creation of the widgets once the pieces XML was loaded.
/// this is where all the work of creating the family tabs and their content is performed.
void PicsSelectWidget::continueCreate()
{
	const PicBucket& bucket = PicBucket::instance();

	m_tabs = new QTabWidget(this);
	connect(m_tabs, SIGNAL(currentChanged(int)), this, SLOT(updateSetsSpinBox(int)));
	m_layout->addWidget(m_tabs);
	m_groups.resize(bucket.grps.size());

	for (int f = 0; f < bucket.families.size(); ++f)
	{
		const PicFamily &fam = bucket.families[f];

		SizedWidget *tab = new SizedWidget(QSize(6 * BOT_TOTAL_X + BOT_OFFS_X + FRAME_OFFS_SPACE_RIGHT - 5, NUM_DEFS * BOT_TOTAL_Y + FRAME_OFFS_Y), nullptr);
		//QWidget *tab = new QWidget();
		//tab->resize(QSize(6 * BOT_TOTAL_X + BOT_OFFS_X + FRAME_OFFS_SPACE_RIGHT, NUM_DEFS * BOT_TOTAL_Y + FRAME_OFFS_Y));

		QScrollArea *scroll = new QScrollArea();
		scroll->setWidget(tab);
		// the following is the voodoo needed to make the scroll area the same color as the tab
		// if this wasn't here, the scroll area would have gotten the default window color
		// this is significant in Windows XP with new apperance style where the tab color is 
		// different from the default window color
		scroll->viewport()->setAutoFillBackground(false);
		tab->setAutoFillBackground(false);
		// scroll area has a frame by default. get rid of it.
		scroll->setFrameShape(QFrame::NoFrame);

		m_tabs->addTab(scroll, fam.name.c_str());


		for (int g = fam.startIndex; g < fam.startIndex + fam.numGroups; ++g)
		{
			const PicGroupDef *grp = &(bucket.grps[g]);
			GroupCtrl &grpctrl = m_groups[g];
			int normg = (g - fam.startIndex); // normalized g with start of family

			QGroupBox *groupbox = new QGroupBox(grp->name.c_str(), tab);
			groupbox->move(BOT_OFFS_X-FRAME_OFFS_SPACE_LEFT, FRAME_OFFS_Y + normg*BOT_TOTAL_Y - 30);
			groupbox->resize(FRAME_OFFS_SPACE_RIGHT + grp->numPics() * BOT_TOTAL_X, BOT_Y + 55);

			grpctrl.num = new DataSpinBox(g, tab);
			grpctrl.num->move(grp->numPics() * BOT_TOTAL_X + BOT_OFFS_X + FRAME_OFFS_SPACE_RIGHT - 65, BOT_OFFS_Y + normg*BOT_TOTAL_Y + 40);
			grpctrl.num->resize(45, 23);
			grpctrl.num->setButtonSymbols(QAbstractSpinBox::PlusMinus);
			grpctrl.num->setRange(-1, MAX_IDENTICAL_PIECES); 
			grpctrl.num->setSpecialValueText("X");

			connect(grpctrl.num, SIGNAL(dvalueChanged(int, int)), this, SLOT(changedGrpBox(int, int)));


			for (int p = 0; p < bucket.grps[g].numPics(); ++p)
			{
				const PicDef* pic = &(grp->getPic(p));
				PicCtrl picctrl;
				int data = (g << 16) | p;

				DataPushButton *button = new DataPushButton(data, QIcon(pic->pixmap), QString(), tab);
				picctrl.bot = button;
				button->setCheckable(true);
				button->move(BOT_OFFS_X + p*BOT_TOTAL_X, BOT_OFFS_Y + normg * BOT_TOTAL_Y); // g normalized to start of family
				button->resize(BOT_X, BOT_Y);
				button->setIconSize(pic->pixmap.size()); // +1 because it's the texture + line, from Pieces.h
				connect(button, SIGNAL(pclicked(int, bool)), this, SLOT(pressedPicButton(int, bool)));

				DataSpinBox *spinbox = new DataSpinBox(data, tab);
				picctrl.num = spinbox;
				spinbox->setRange(0, MAX_IDENTICAL_PIECES);
				spinbox->move(BOT_OFFS_X + p*BOT_TOTAL_X + (BOT_X/5*2 + 2), BOT_OFFS_Y + normg*BOT_TOTAL_Y + BOT_Y + 5);
				spinbox->resize(BOT_X/5*3 - 4, EDIT_THICK + 1);
				spinbox->setButtonSymbols(QAbstractSpinBox::PlusMinus);
				
				connect(spinbox, SIGNAL(dvalueChanged(int, int)), this, SLOT(changedNumBox(int, int)));

				QLabel *solnum = new QLabel("0", tab);
				picctrl.snum = solnum;
				solnum->move(BOT_OFFS_X + p*BOT_TOTAL_X + 2, BOT_OFFS_Y + normg*BOT_TOTAL_Y + BOT_Y + 6);
				solnum->resize(BOT_X/5*2 - 4, EDIT_THICK); 
				solnum->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
				solnum->setFrameShadow(QFrame::Sunken);
				solnum->setFrameShape(QFrame::Panel);
				
				solnum->setPalette(*m_slvPalette);
				solnum->setVisible(false);


				grpctrl.pics.push_back(picctrl);
			}

		}

	}

	setBuildTilesCount(m_doc->getBuild().tilesCount());
	// prevent the build Help sidebar to get notifications. it might not be there yet.
	// eventually the sidebar will take care of itself.
	blockSignals(true); 
	changeToResetValues();
	blockSignals(false);

	m_bFinishedCreate = true;
}
コード例 #20
0
void KPrWebPresentationWizard::setupPage1()
{
    page1 = new QHBox( this );
    QWhatsThis::add( page1, i18n("This page allows you to specify some of the key"
                                 " values for how your presentation will be shown"
                                 " in HTML. Select individual items for more help"
                                 " on what they do.") );
    page1->setSpacing( KDialog::spacingHint() );
    page1->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page1 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page1 );
    QGridLayout *layout = new QGridLayout( canvas, 7, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignTop| Qt::AlignLeft );
    helptext->setText( i18n( "Enter your name, email address and "
                             "the title of the web presentation. "
                             "Also enter the output directory where the "
                             "web presentation should be saved. " ) );
    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 50 ), 1, 1, 0, 1 );

    QLabel *label1 = new QLabel( i18n("Author:"), canvas );
    label1->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label1, i18n("This is where you enter the name of the person or "
                                  "organization that should be named as the author of "
                                  "the presentation.") );
    layout->addWidget( label1, 2, 0 );

    QLabel *label2 = new QLabel( i18n("Title:"), canvas );
    label2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label2, i18n("This is where you enter the title of the overall "
                                  "presentation." ) );
    layout->addWidget( label2, 3, 0 );

    QLabel *label3 = new QLabel( i18n("Email address:"), canvas );
    label3->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label3, i18n("This is where you enter the email address of the "
                                  "person or organization that is responsible for "
                                  "the presentation.") );
    layout->addWidget( label3, 4, 0 );

    QLabel *label4 = new QLabel( i18n("Path:"), canvas );
    label4->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label4, i18n("The value entered for the path is the directory "
                                  "where the presentation will be saved. If it does "
                                  "not exist, you'll be asked if you want to create "
                                  "the directory or abort the creation.") );
    layout->addWidget( label4, 5, 0 );

    author = new KLineEdit( webPres.getAuthor(), canvas );
    QWhatsThis::add( author, i18n("This is where you enter the name of the person or "
                                  "organization that should be named as the author of "
                                  "the presentation.") );
    layout->addWidget( author, 2, 1 );

    title = new KLineEdit( webPres.getTitle(), canvas );
    QWhatsThis::add( title, i18n("This is where you enter the title of the overall "
                                 "presentation." ) );
    layout->addWidget( title, 3, 1 );

    email = new KLineEdit( webPres.getEmail(), canvas );
    QWhatsThis::add( email, i18n("This is where you enter the email address of the "
                                 "person or organization that is responsible for "
                                 "the presentation.") );
    layout->addWidget( email, 4, 1 );

    path=new KURLRequester( canvas );
    path->setMode( KFile::Directory);
    path->lineEdit()->setText(webPres.getPath());
    QWhatsThis::add( path, i18n("The value entered for the path is the directory "
                                "where the presentation will be saved. If it does "
                                "not exist, you'll be asked if you want to create "
                                "the directory or abort the creation.") );
    layout->addWidget( path, 5, 1 );

    QSpacerItem* spacer = new QSpacerItem( 1, 10,
                                           QSizePolicy::Minimum, QSizePolicy::Expanding );
    layout->addMultiCell( spacer, 6, 6, 0, 1 );

    connect(path, SIGNAL(textChanged(const QString&)),
            this,SLOT(slotChoosePath(const QString&)));
    connect(path, SIGNAL(urlSelected( const QString& )),
            this,SLOT(slotChoosePath(const QString&)));

    addPage( page1, i18n( "Step 1: General Information" ) );

    setHelpEnabled(page1, false);  //doesn't do anything currently
}