inline void MainWindow::createCheckBoxLegend()
{
    QWidget* iLegend = new QWidget;
    iLegend->setStyleSheet("background-color: red;");
    iLegend->setFixedSize(16, 16);
    iLegend->setAutoFillBackground(true);
    
    QWidget* bLegend = new QWidget;
    bLegend->setStyleSheet("background-color: blue;");
    bLegend->setFixedSize(16, 16);
    bLegend->setAutoFillBackground(true);
    
    QWidget* pLegend = new QWidget;
    pLegend->setStyleSheet("background-color: yellow;");
    pLegend->setFixedSize(16, 16);
    pLegend->setAutoFillBackground(true);
    
    QWidget* sLegend = new QWidget;
    sLegend->setStyleSheet("background-color: green;");
    sLegend->setFixedSize(16, 16);
    sLegend->setAutoFillBackground(true);
    
    checkBoxLayout->addWidget(iLegend, 0, 1);
    checkBoxLayout->addWidget(bLegend, 1, 1);
    checkBoxLayout->addWidget(pLegend, 2, 1);
    checkBoxLayout->addWidget(sLegend, 3, 1);
}
Example #2
0
UIVMDesktop::UIVMDesktop(UIToolBar *pToolBar, QAction *pRefreshAction, QWidget *pParent)
    : QIWithRetranslateUI<QWidget>(pParent)
{
    /* Prepare buttons: */
    m_pHeaderBtn = new UITexturedSegmentedButton(2);
    m_pHeaderBtn->setIcon(Dtls, UIIconPool::iconSet(":/settings_16px.png"));
    m_pHeaderBtn->setIcon(Snap, UIIconPool::iconSet(":/take_snapshot_16px.png",
                                                    ":/take_snapshot_dis_16px.png"));
    m_pHeaderBtn->animateClick(0);

    /* Prepare main layout: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    pMainLayout->setContentsMargins(0, 0, 0, 0);

    /* The header to select the different pages.
     * Has different styles on the different platforms. */
#ifdef USE_TOOLBAR
    if (pToolBar)
    {
        pToolBar->addWidget(new UIHorizontalSpacerWidget(this));
        pToolBar->addWidget(m_pHeaderBtn);
        QWidget *pSpace = new QWidget(this);
        /* We need a little bit more space for the beta label. */
        if (vboxGlobal().isBeta())
            pSpace->setFixedSize(28, 1);
        else
            pSpace->setFixedSize(10, 1);
        pToolBar->addWidget(pSpace);
        pToolBar->updateLayout();
    }
    else
#else /* USE_TOOLBAR */
        NOREF(pToolBar);
#endif /* !USE_TOOLBAR */
    {
        UIBar *pBar = new UIBar(this);
        pBar->setContentWidget(m_pHeaderBtn);
        pMainLayout->addWidget(pBar);
    }

    /* Create desktop pane: */
    m_pDesktopPrivate = new UIVMDesktopPrivate(this, pRefreshAction);

    /* Create snapshot pane: */
    m_pSnapshotsPane = new VBoxSnapshotsWgt(this);
    m_pSnapshotsPane->setContentsMargins(gsLeftMargin, gsTopMargin, gsRightMargin, gsBottomMargin);

    /* Add the pages: */
    m_pStackedLayout = new QStackedLayout(pMainLayout);
    m_pStackedLayout->addWidget(m_pDesktopPrivate);
    m_pStackedLayout->addWidget(m_pSnapshotsPane);

    /* Connect the header buttons with the stack layout: */
    connect(m_pHeaderBtn, SIGNAL(clicked(int)), m_pStackedLayout, SLOT(setCurrentIndex(int)));
    connect(m_pStackedLayout, SIGNAL(currentChanged(int)), this, SIGNAL(sigCurrentChanged(int)));

    /* Translate finally: */
    retranslateUi();
}
Example #3
0
void ItemWidget::updateSize(const QSize &maximumSize, int idealWidth)
{
    QWidget *w = widget();
    w->setMaximumSize(maximumSize);
    const int idealHeight = w->heightForWidth(idealWidth);
    const int maximumHeight = w->heightForWidth(maximumSize.width());
    if (idealHeight <= 0 && maximumHeight <= 0)
        w->resize(w->sizeHint());
    else if (idealHeight != maximumHeight)
        w->setFixedSize( maximumSize.width(), maximumHeight );
    else
        w->setFixedSize(idealWidth, idealHeight);
}
Example #4
0
void MainWindow::setup(){
    cntnumber = 1;
    QWidget *widget = new QWidget(this);
    QHBoxLayout *layout = new QHBoxLayout(widget);
    layout->addStretch(20);
    layout->addWidget(formheadl);
    layout->addStretch(20);
#if DUAL_SYSTEM
    layout->addWidget(formheadr);
    layout->addStretch(20);
    widget->setFixedSize(780,280);
    widget->move(10,80);
#else
    widget->setFixedSize(460,280);
    widget->move(170,80);
#endif

    connect(&hmiData,SIGNAL(time1sOuted()),this,SLOT(Timeout1s()));
    connect(&hmiData,SIGNAL(clothFinishCountChanged(int)),label_FinishCount,SLOT(setNum(int)));
    connect(&hmiData,SIGNAL(clothSetCountChanged(int)),label_setCount,SLOT(setNum(int)));
    connect(&patternData,SIGNAL(patternChanged(QString,QString)), SLOT(onpatternChange(QString,QString)));
    connect(&hmiData,SIGNAL(hmi_loopend(int)),label_loopEnd,SLOT(setNum(int)));
    connect(&hmiData,SIGNAL(hmi_loopleft(int)),label_loopLeft,SLOT(setNum(int)));
    connect(&hmiData,SIGNAL(hmi_loopStart(int)),label_loopStart,SLOT(setNum(int)));
    connect(&hmiData,SIGNAL(hmi_loopend(int)),label_loopEnd,SLOT(setNum(int)));
    connect(&hmiData,SIGNAL(hmi_loopTatal(int)),label_loopCount,SLOT(setNum(int)));
    connect(&hmiData,SIGNAL(hmi_cntNumber(unsigned short)),SLOT(runPatternRowChange(unsigned short)));
    connect(&hmiData,SIGNAL(hmi_jitouxiangduizhengshu(int)),label_zwz,SLOT(setNum(int)));
    connect(&hmiData,SIGNAL(xtGuilingError()),SLOT(onXtGuilingError()));
    connect(&hmiData,SIGNAL(xtRunOrGuiling(bool)),qMdPushButton_5,SLOT(setChecked(bool)));
    connect(&hmiData,SIGNAL(lineLock(bool)),qMdPushButton_6,SLOT(setChecked(bool)));
    connect(&hmiData,SIGNAL(speedLimit(bool)),qMdPushButton_8,SLOT(setChecked(bool)));
    connect(&hmiData,SIGNAL(stopPerOne(bool)),qMdPushButton_9,SLOT(setChecked(bool)));
    connect(&hmiData,SIGNAL(alarmLimit(bool)),qMdPushButton_10,SLOT(setChecked(bool)));
    connect(&hmiData,SIGNAL(shazuiUp(bool)),qMdPushButton_11,SLOT(setChecked(bool)));
    connect(&hmiData,SIGNAL(runing(bool)),SLOT(onHmidataRuning(bool)));
    connect(&hmiData,SIGNAL(powerDown()),SLOT(onPowerDown()));
    connect(&paramaData,SIGNAL(changed()),SLOT(onParamChanded()));
    azllist<<tr("空")<<tr("翻针")<<tr("编织");
    hzllist<<tr("空")<<tr("吊目")<<tr("接针")<<tr("吊目2")<<tr("编松2");
#if DUAL_SYSTEM
    connect(&hmiData,SIGNAL(sigDankouLock(bool)),SLOT(onDankouLock(bool)));
    label_dankoulock->setText(hmiData.dankouLock()?tr("锁定"):tr("不锁定"));
#else
    frame_dankoulock->hide();
#endif

}
Example #5
0
void MainWindow::createScene()
{
	graphicsScene = new GraphicsScene( &project, spriteView, animationView, 0, 0, 640, 480 );
	graphicsView = new GraphicsView(graphicsScene);
	graphicsView->scale( 1, 1 );
	graphicsView->rotate( 0 );
	graphicsView->setStyleSheet( "QGraphicsView { border-style: none; }" ); 
	graphicsScene->setGraphicsView( graphicsView );

	widgetRulerH = new WidgetRuler( this, graphicsView, false );
	widgetRulerV = new WidgetRuler( this, graphicsView, true );

	QGridLayout* layout = new QGridLayout();
	layout->setSpacing( 0 );
	layout->setMargin( 0 );
	QWidget* fake = new QWidget();
	fake->setBackgroundRole( QPalette::Dark );
	fake->setFixedSize( 20, 20 );
	layout->addWidget( fake, 0, 0 );
	layout->addWidget( widgetRulerV, 1, 0 );
	layout->addWidget( widgetRulerH, 0, 1 );
	layout->addWidget( graphicsView, 1, 1 );
	QFrame* f = new QFrame( this );
	f->setLayout( layout );
	setCentralWidget( f );

	connect( graphicsView, SIGNAL( repaintRulers() ), widgetRulerH, SLOT( repaintRulers() ) );
	connect( graphicsView, SIGNAL( repaintRulers() ), widgetRulerV, SLOT( repaintRulers() ) );

	connect( widgetRulerH, SIGNAL( dragRuler( int ) ), graphicsView, SLOT( dragHorizontalRuler( int ) ) );
	connect( widgetRulerV, SIGNAL( dragRuler( int ) ), graphicsView, SLOT( dragVerticalRuler( int ) ) );

	connect( widgetRulerH, SIGNAL( dropRuler( int ) ), graphicsView, SLOT( dropHorizontalRuler( int ) ) );
	connect( widgetRulerV, SIGNAL( dropRuler( int ) ), graphicsView, SLOT( dropVerticalRuler( int ) ) );
}
Example #6
0
QWidget * ladspaBrowserView::createTab( QWidget * _parent, const QString & _txt,
							ladspaPluginType _type )
{
	QWidget * tab = new QWidget( _parent );
	tab->setFixedSize( 500, 400 );
	QVBoxLayout * layout = new QVBoxLayout( tab );
	layout->setSpacing( 0 );
	layout->setMargin( 0 );

	const QString type = "<b>" + tr( "Type:" ) + "</b> ";
	QLabel * title = new QLabel( type + _txt, tab );
	QFont f = title->font();
	f.setBold( true );
	title->setFont( pointSize<12>( f ) );

	layout->addSpacing( 5 );
	layout->addWidget( title );
	layout->addSpacing( 10 );

	ladspaDescription * description = new ladspaDescription( tab, _type );
	connect( description, SIGNAL( doubleClicked( const ladspa_key_t & ) ),
				SLOT( showPorts( const ladspa_key_t & ) ) );
	layout->addWidget( description, 1 );

	return tab;
}
void KisSelectionToolConfigWidgetHelper::createOptionWidget(KisCanvas2 *canvas, const QString &toolId)
{
    m_optionsWidget = new KisSelectionOptions(canvas);
    Q_CHECK_PTR(m_optionsWidget);

    // slotCanvasResourceChanged... yuck
    m_resourceProvider = canvas->viewManager()->resourceProvider();
    // connect(m_resourceProvider->resourceManager(), &KisCanvasResourceManager::canvasResourceChanged,
    //         this, KisSelectionToolConfigWidgetHelper::slotCanvasResourceChanged);

    m_optionsWidget->setObjectName(toolId + "option widget");
    m_optionsWidget->setWindowTitle(m_windowTitle);
    m_optionsWidget->setAction(selectionAction());
    m_optionsWidget->setMode(selectionMode());

    // See https://bugs.kde.org/show_bug.cgi?id=316896
    QWidget *specialSpacer = new QWidget(m_optionsWidget);
    specialSpacer->setObjectName("SpecialSpacer");
    specialSpacer->setFixedSize(0, 0);
    m_optionsWidget->layout()->addWidget(specialSpacer);

    connect(m_optionsWidget, &KisSelectionOptions::actionChanged,
            this, &KisSelectionToolConfigWidgetHelper::slotWidgetActionChanged);
    connect(m_optionsWidget, &KisSelectionOptions::modeChanged,
            this, &KisSelectionToolConfigWidgetHelper::slotWidgetModeChanged);
    connect(m_resourceProvider, &KisCanvasResourceProvider::sigSelectionActionChanged,
            this, &KisSelectionToolConfigWidgetHelper::slotGlobalActionChanged);
    connect(m_resourceProvider, &KisCanvasResourceProvider::sigSelectionModeChanged,
            this, &KisSelectionToolConfigWidgetHelper::slotGlobalModeChanged);

    m_optionsWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    m_optionsWidget->adjustSize();
}
Example #8
0
File: main.cpp Project: wladaf/Qt
int main(int argv, char **args)
{
	QApplication app(argv, args);
	int n = 8;
	int size = 40;
	int bsize = (n*size - 5)/3 - 5;
	QPushButton *buttons[n][n];

	QWidget window;
	window.setGeometry(300, 300, 10+size*n, 5+size*n + size + 10);
	window.setFixedSize(window.size());
	for(i = 0; i < n; i++)
	{
		for(j = 0; j < n; j++)
		{
			buttons[i][j] = new QPushButton("", &window);
			QObject::connect(buttons[i][j], SIGNAL(clicked()), qApp, SLOT(quit()));
			buttons[i][j]->setGeometry(5+i*size, 5+j*size, size, size);
		}
	}
	QPushButton *newGameButton = new QPushButton("New Game", &window);
	newGameButton->setGeometry(5, n*size + 10, bsize, size);

	QPushButton *diffButton = new QPushButton("Difficulty", &window);
	diffButton->setGeometry(5 + 2*n*size/3 + 5, n*size + 10, bsize, size);

	window.show();
	return app.exec();
}
Example #9
0
int main(int argc, char *argv[])
{

    QApplication a(argc, argv);
    QWidget w;
    w.setWindowTitle ( "Quelle est cette note?" );

    w.setFixedSize(800, 720);

    // set color background
    QPalette Pal(w.palette());
    Pal.setColor(QPalette::Background, QColor::fromRgb(250, 250, 250));
    w.setAutoFillBackground(true);
    w.setPalette(Pal);


    po = new Portee(&w);
    Piano *pi = new Piano(&w);
    po->setPiano(pi);

    addMenus(&w);
    QVBoxLayout qvbox;
    qvbox.addWidget(po);
    qvbox.addWidget(pi);
    w.setLayout(&qvbox);

    w.show();

    return a.exec();
}
    QList<QWidget*> createItemWidgets(const QModelIndex& /*index*/) const
    {
        // a lump of coal and a piece of elastic will get you through the world
        QModelIndex idx = property("goya:creatingWidgetForIndex").value<QModelIndex>();

        QWidget *page = new QWidget;
        QHBoxLayout *layout = new QHBoxLayout(page);

        QCheckBox *checkBox = new QCheckBox;
        checkBox->setProperty("fileitem", idx.data());

        connect(checkBox, SIGNAL(toggled(bool)), m_parent, SLOT(toggleFileItem(bool)));
        QLabel *thumbnail = new QLabel;
        QLabel *filename = new QLabel;
        QLabel *dateModified = new QLabel;

        layout->addWidget(checkBox);
        layout->addWidget(thumbnail);
        layout->addWidget(filename);
        layout->addWidget(dateModified);

        page->setFixedSize(600, 200);

        return QList<QWidget*>() << page;
    }
Example #11
0
QWidget * malletsInstrumentView::setupBandedWGControls( QWidget * _parent )
{
	// BandedWG
	QWidget * widget = new QWidget( _parent );
	widget->setFixedSize( 250, 250 );
	
	m_strikeLED = new ledCheckBox( tr( "Bowed" ), widget );
	m_strikeLED->move( 138, 25 );

	m_pressureKnob = new knob( knobVintage_32, widget );
	m_pressureKnob->setLabel( tr( "Pressure" ) );
	m_pressureKnob->move( 30, 90 );
	m_pressureKnob->setHintText( tr( "Pressure:" ) + " ", "" );

	m_motionKnob = new knob( knobVintage_32, widget );
	m_motionKnob->setLabel( tr( "Motion" ) );
	m_motionKnob->move( 110, 90 );
	m_motionKnob->setHintText( tr( "Motion:" ) + " ", "" );
	
	m_velocityKnob = new knob( knobVintage_32, widget );
	m_velocityKnob->setLabel( tr( "Speed" ) );
	m_velocityKnob->move( 30, 140 );
	m_velocityKnob->setHintText( tr( "Speed:" ) + " ", "" );
	
	m_vibratoKnob = new knob( knobVintage_32, widget, tr( "Vibrato" ) );
	m_vibratoKnob->setLabel( tr( "Vibrato" ) );
	m_vibratoKnob->move( 110, 140 );
	m_vibratoKnob->setHintText( tr( "Vibrato:" ) + " ", "" );
	
	return( widget );
}
Example #12
0
QWidget * malletsInstrumentView::setupModalBarControls( QWidget * _parent )
{
	QWidget * widget = new QWidget( _parent );
	widget->setFixedSize( 250, 250 );
		
	m_hardnessKnob = new knob( knobVintage_32, widget );
	m_hardnessKnob->setLabel( tr( "Hardness" ) );
	m_hardnessKnob->move( 30, 90 );
	m_hardnessKnob->setHintText( tr( "Hardness:" ) + " ", "" );

	m_positionKnob = new knob( knobVintage_32, widget );
	m_positionKnob->setLabel( tr( "Position" ) );
	m_positionKnob->move( 110, 90 );
	m_positionKnob->setHintText( tr( "Position:" ) + " ", "" );

	m_vibratoGainKnob = new knob( knobVintage_32, widget );
	m_vibratoGainKnob->setLabel( tr( "Vib Gain" ) );
	m_vibratoGainKnob->move( 30, 140 );
	m_vibratoGainKnob->setHintText( tr( "Vib Gain:" ) + " ", "" );

	m_vibratoFreqKnob = new knob( knobVintage_32, widget );
	m_vibratoFreqKnob->setLabel( tr( "Vib Freq" ) );
	m_vibratoFreqKnob->move( 110, 140 );
	m_vibratoFreqKnob->setHintText( tr( "Vib Freq:" ) + " ", "" );

	m_stickKnob = new knob( knobVintage_32, widget );
	m_stickKnob->setLabel( tr( "Stick Mix" ) );
	m_stickKnob->move( 190, 90 );
	m_stickKnob->setHintText( tr( "Stick Mix:" ) + " ", "" );
	
	return( widget );
}
Example #13
0
QWidget * malletsInstrumentView::setupTubeBellControls( QWidget * _parent )
{
	QWidget * widget = new QWidget( _parent );
	widget->setFixedSize( 250, 250 );
	
	m_modulatorKnob = new knob( knobVintage_32, widget );
	m_modulatorKnob->setLabel( tr( "Modulator" ) );
	m_modulatorKnob->move( 30, 90 );
	m_modulatorKnob->setHintText( tr( "Modulator:" ) + " ", "" );

	m_crossfadeKnob = new knob( knobVintage_32, widget );
	m_crossfadeKnob->setLabel( tr( "Crossfade" ) );
	m_crossfadeKnob->move( 110, 90 );
	m_crossfadeKnob->setHintText( tr( "Crossfade:" ) + " ", "" );
	
	m_lfoSpeedKnob = new knob( knobVintage_32, widget );
	m_lfoSpeedKnob->setLabel( tr( "LFO Speed" ) );
	m_lfoSpeedKnob->move( 30, 140 );
	m_lfoSpeedKnob->setHintText( tr( "LFO Speed:" ) + " ", "" );
	
	m_lfoDepthKnob = new knob( knobVintage_32, widget );
	m_lfoDepthKnob->setLabel( tr( "LFO Depth" ) );
	m_lfoDepthKnob->move( 110, 140 );
	m_lfoDepthKnob->setHintText( tr( "LFO Depth:" ) + " ", "" );
	
	m_adsrKnob = new knob( knobVintage_32, widget );
	m_adsrKnob->setLabel( tr( "ADSR" ) );
	m_adsrKnob->move( 190, 90 );
	m_adsrKnob->setHintText( tr( "ADSR:" ) + " ", "" );

	return( widget );
}
Example #14
0
 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);
     QWidget window;
     QLabel *label = new QLabel(QApplication::translate("windowlayout", "Scale:"),&window);
	 QCheckBox *chb = new QCheckBox(QApplication::translate("windowlayout", "Calc mode"),&window);
	 mle *myline = new mle(&window);
	 render widget(&window);
     QPainter painter;
	 QSlider *spinbox = new QSlider(Qt::Horizontal,&window);
	 spinbox->setValue(30);
	 widget.setGeometry(10,10, 512, 512);
	 myline->setGeometry(10,532,512,20);
	 myline->setText("Enter expession");
	 myline->createStandardContextMenu();
	 myline->selectAll();
	 label->setGeometry(532,10,200,20);
	 chb->move(532,535);
	 spinbox->setGeometry(567,10,165,20);
	 spinbox->setRange(1, 200);
	 //Святое место определения механизма сигналов и слотов, унёсший 8 дней практики на реализацию передачи значений между экземплярами класса
	 //изменять с осторожностью и благословлением, церковная зона
	 QObject::connect(spinbox, SIGNAL(valueChanged(int)), &widget, SLOT(scale(int)));
	 QObject::connect(spinbox, SIGNAL(valueChanged(int)), myline, SLOT(emitsig()));
	 QObject::connect(myline, SIGNAL(returnPressed()), myline, SLOT(emitsig()));
	 QObject::connect(myline, SIGNAL(givechar(QString)), &widget, SLOT(calc(QString)));
	 QObject::connect(chb, SIGNAL(stateChanged(int)), &widget, SLOT(chk(int)));
	 QObject::connect(&widget, SIGNAL(emitstr(QString)), myline, SLOT(takestr(QString)));
	 //конец защищенной церковной зоны
     window.setWindowTitle(
         QApplication::translate("GCPLOT", "GCPLOT"));
	 window.setFixedSize(742, 562);
	 window.show();
     return app.exec();
 }
Example #15
0
QWidget *AlbumPanel::makeAlbumArt() {
    QWidget *artwork = new QWidget();
    artwork->setFixedSize(111,111);
    artwork->setObjectName("AlbumArtPicture");
    artwork->setStyleSheet(util.getStylesheet());
    return artwork;
}
void ControllerRackView::update()
{
	QWidget * w = m_scrollArea->widget();
	song * s = engine::getSong();

	setUpdatesEnabled( false );

	int i = 0;
	for( i = 0; i < m_controllerViews.size(); ++i )
	{
		delete m_controllerViews[i];
	}

	m_controllerViews.clear();

	for( i = 0; i < s->m_controllers.size(); ++i )
	{
		ControllerView * v = new ControllerView( s->m_controllers[i], w );

		connect( v, SIGNAL( deleteController( ControllerView * ) ),
			this, SLOT( deleteController( ControllerView * ) ),
						Qt::QueuedConnection );

		m_controllerViews.append( v );
		v->move( 0, i*32 );
		v->show();
	}

	w->setFixedSize( 210, i*32 );

	setUpdatesEnabled( true );
	QWidget::update();
}
Example #17
0
void ItemWidget::updateSize(const QSize &maximumSize)
{
    QWidget *w = widget();
    w->setMinimumSize(0, 0);
    w->setMaximumSize(maximumSize);
    w->adjustSize();
    w->setFixedSize( w->size() );
}
Example #18
0
void v3dDataFibers::generateThumbnails() const
{
    d->thumbnails.clear();

    // we must use a parent to prevent infinte recursion of the QVTKWidget
    // see: http://vtk.1045678.n5.nabble.com/qtimageviewer-example-crashes-with-vtk-5-6-0-td1249263.html
    //
    QWidget *parent = new QWidget;

    QVTKWidget *widget = new QVTKWidget (parent);
    QVBoxLayout *l = new QVBoxLayout(parent);
    l->setContentsMargins(0,0,0,0);
    l->addWidget(widget);


    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
    vtkActor *actor = vtkActor::New();
    vtkRenderer *renderer = vtkRenderer::New();
    vtkRenderWindow *window = vtkRenderWindow::New();
    widget->SetRenderWindow(window);

    parent->setFixedSize(128,128);
    parent->show();

    mapper->SetInput (d->data->GetFibers());
    actor->SetMapper (mapper);
    renderer->AddViewProp(actor);
    window->SetSize (128,128);
    window->AddRenderer (renderer);
    //window->OffScreenRenderingOn();
    renderer->ResetCamera();

    //window->Render();
    parent->update();

    // make sure widget is shown and that openGL context is initialized
    // otherwise, an infinite loop happens when calling GetRGBACharPixelData
    qApp->processEvents();

    unsigned int w=128, h=128;
    d->thumbnail = QImage(w, h, QImage::Format_ARGB32);

    vtkUnsignedCharArray* pixels = vtkUnsignedCharArray::New();
    pixels->SetArray(d->thumbnail.bits(), w*h*4, 1);
    window->GetRGBACharPixelData(0, 0, w-1, h-1, 1, pixels);

    parent->hide();

    d->thumbnails.append (d->thumbnail);

    pixels->Delete();
    mapper->Delete();
    actor->Delete();
    renderer->Delete();
    window->Delete(); // crash if window is deleted
    parent->deleteLater();
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_clicks(0)
{
    ui->setupUi(this);
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));

    connect(ui->lineEdit, SIGNAL(textChanged(QString)), ui->textEditDisplay, SLOT(setText(QString)));
    connect(ui->textEdit, SIGNAL(textChanged()), this, SLOT(updateTextEditDisplay()));

    connect(ui->pushButton, SIGNAL(pressed()), this, SLOT(updatePushButtonDisplay()));
    connect(ui->pushButton, SIGNAL(released()), this, SLOT(updatePushButtonDisplay()));
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(updateClickCount()));
    connect(ui->radioButton1, SIGNAL(toggled(bool)), this, SLOT(updateRadioButtonDisplay()));
    connect(ui->radioButton2, SIGNAL(toggled(bool)), this, SLOT(updateRadioButtonDisplay()));
    connect(ui->checkBox, SIGNAL(stateChanged(int)), this, SLOT(updateCheckBoxDisplay()));
    connect(ui->comboBox, SIGNAL(activated(int)), this, SLOT(updateComboBoxDisplay()));
    connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(updateHorizontalSliderDisplay()));

    QWidget *contents = new QWidget;
    contents->setObjectName("contents");
    contents->setFixedSize(QSize(500, 500));
    QPushButton *topLeft = new QPushButton(contents);
    topLeft->setObjectName("topLeft");
    topLeft->setFixedSize(QSize(20,20));
    topLeft->move(10, 10);
    QPushButton *topRight = new QPushButton(contents);
    topRight->setObjectName("topRight");
    topRight->setFixedSize(QSize(20,20));
    topRight->move(470, 10);
    QPushButton *bottomLeft = new QPushButton(contents);
    bottomLeft->setObjectName("bottomLeft");
    bottomLeft->setFixedSize(QSize(20,20));
    bottomLeft->move(10, 470);
    QPushButton *bottomRight = new QPushButton(contents);
    bottomRight->setObjectName("bottomRight");
    bottomRight->setFixedSize(QSize(20,20));
    bottomRight->move(470, 470);

    ui->scrollArea->setWidget(contents);

    QStandardItemModel *model = new QStandardItemModel(this);
    model->setHorizontalHeaderLabels(QStringList() << tr("items"));
    QStandardItem *parentItem;
    for (int j = 0; j < 3; ++j) {
        parentItem = model->invisibleRootItem();
        for (int i = 0; i < 4; ++i) {
            QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
            parentItem->appendRow(item);
            parentItem = item;
        }
    }

    ui->treeView->setModel(model);
}
Example #20
0
FlexibleHeader::FlexibleHeader( FlexibleView* parent )
    : BasicHeader( parent )
    , m_parent( parent )
{
    QFile f( RESPATH "stylesheets/topbar-radiobuttons.css" );
    f.open( QFile::ReadOnly );
    QString css = QString::fromLatin1( f.readAll() );
    f.close();

    QHBoxLayout* outerModeLayout = new QHBoxLayout;
    m_verticalLayout->addLayout( outerModeLayout );
    outerModeLayout->addSpacing( 156 );
    outerModeLayout->addStretch();

    QWidget* modeWidget = new QWidget( this );
    QHBoxLayout* modeLayout = new QHBoxLayout;
    modeWidget->setLayout( modeLayout );
    modeWidget->setStyleSheet( css );

    m_radioNormal = new QRadioButton( modeWidget );
    m_radioDetailed = new QRadioButton( modeWidget );
    m_radioCloud = new QRadioButton( modeWidget );
    //for the CSS:
    m_radioNormal->setObjectName( "radioNormal" );
    m_radioCloud->setObjectName( "radioCloud" );

    m_radioNormal->setFocusPolicy( Qt::NoFocus );
    m_radioDetailed->setFocusPolicy( Qt::NoFocus );
    m_radioCloud->setFocusPolicy( Qt::NoFocus );

    modeLayout->addWidget( m_radioNormal );
    modeLayout->addWidget( m_radioDetailed );
    modeLayout->addWidget( m_radioCloud );

    modeWidget->setFixedSize( 87, 30 );

    m_radioNormal->setChecked( true );

    outerModeLayout->addWidget( modeWidget );
    outerModeLayout->addStretch();

    m_filterField = new QSearchField( this );
    m_filterField->setPlaceholderText( tr( "Filter..." ) );
    m_filterField->setFixedWidth( 220 );
    m_mainLayout->addWidget( m_filterField );

    TomahawkUtils::unmarginLayout( outerModeLayout );
    TomahawkUtils::unmarginLayout( modeLayout );

    connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
    connect( m_filterField, SIGNAL( textChanged( QString ) ), SLOT( onFilterEdited() ) );

    NewClosure( m_radioNormal,   SIGNAL( clicked() ), const_cast< FlexibleView* >( parent ), SLOT( setCurrentMode( FlexibleViewMode ) ), FlexibleView::Flat )->setAutoDelete( false );
    NewClosure( m_radioDetailed, SIGNAL( clicked() ), const_cast< FlexibleView* >( parent ), SLOT( setCurrentMode( FlexibleViewMode ) ), FlexibleView::Detailed )->setAutoDelete( false );
    NewClosure( m_radioCloud,    SIGNAL( clicked() ), const_cast< FlexibleView* >( parent ), SLOT( setCurrentMode( FlexibleViewMode ) ), FlexibleView::Grid )->setAutoDelete( false );
}
CoeffsDisplay::CoeffsDisplay(const int& buttonNumber, 
                             const int& frame, 
                             std::vector<int> coeffs)
{
    this->buttonNumber = buttonNumber;
    this->frame = frame;
    float positiveMax = 32767;
    float positiveDouble = positiveMax + positiveMax;
    float rgb = 255;
    QWidget* parent = new QWidget(this);
    QGridLayout* layout = new QGridLayout(parent);
    int across = 0;
    int down = 0;
    for(unsigned int index = 0; index < coeffs.size(); index++)
    {
        float pixelValue = ((float)(coeffs[index] + positiveMax) / positiveDouble) * rgb;
        QWidget* pixel = new QWidget;
        QString colour = "background-color: rgb("+ QString::number(pixelValue, 'g', 5) + ", " 
                                                 + QString::number(pixelValue, 'g', 5) + ", " 
                                                 + QString::number(pixelValue, 'g', 5) + ");";
        pixel->setStyleSheet(colour);
        pixel->setFixedSize(20, 20);
        if((index + 1) % 16 == 0)
        {
            layout->addWidget(pixel, down, across);
            down++;
            across = 0;
        }
        else
        {
            layout->addWidget(pixel, down, across);
            across++;
        }
    }
    layout->setSpacing(0);
    parent->setFixedSize(320, 320);
    this->setWindowTitle("Frame: " + QString::number(frame + 1) 
                        + " Macroblock: " + QString::number(buttonNumber + 1));
    this->setFixedSize(324, 324);
    
    QIcon icon(":icon.png");
    this->setWindowIcon(icon);
}
void tst_Q3DockWindow::initTestCase()
{
    // create a default mainwindow
    // If you run a widget test, this will be replaced in the testcase by the
    // widget under test
    QWidget *w = new QWidget(0,"mainWidget");
    w->setFixedSize( 200, 200 );
    qApp->setMainWidget( w );
    w->show();
}
Example #23
0
int exercice2(int argc, char *argv[]) {
    QApplication app(argc, argv);
    QWidget fenetre;
    fenetre.setFixedSize(200, 200);
    //...
    QLineEdit code(&fenetre);
    code.setFixedWidth(180);

    QTextEdit titre(&fenetre);
    //titre.setGeometry(10,45,180,110);
    titre.setFixedSize(180,110);


    QPushButton save("Sauver",&fenetre);
    save.setFixedWidth(80);
/*
    titre.move(10,45);
    code.move(10,10);
    save.move(10,170);
*/
    /*
    QPushButton exit("Quitter",&fenetre);
    QObject::connect(&exit, SIGNAL(clicked()), qApp, SLOT(quit()));*/

    /*QHBoxLayout coucheH;
    coucheH.addWidget(&save);
    coucheH.addWidget(&exit);
    */

    QVBoxLayout couche;
    /* L'ordre définit l'ordre d'affichage des widgets */
    couche.addWidget(&code);
    couche.addWidget(&titre);
    //couche.addLayout(&coucheH);
    couche.addWidget(&save);

    fenetre.setLayout(&couche); //Indique a fenetre d'utiliser couche pour positionner les objets


    //UVManager m=UVManager::getInstance(); //singleton, constructeur de recopie dans la partie privée, impossible à compiler. Attention médian
    UVManager& m=UVManager::getInstance();

    QString chemin = QFileDialog::getOpenFileName();
   // m.load(chemin);

    UV& lo21=m.getUV("LO21");
    code.setText(lo21.getCode());
    titre.setText(lo21.getTitre());


    fenetre.show();   //appel du show de tous les widgets enfants

    return app.exec();
}
Example #24
0
void MainWindow::on_actionAbout_triggered(){
    QWidget *about = new QWidget;
    about_pic = new QLabel;
    about_text = new QLabel("RagaEditor v0.2beta (c)2014");
    about_pic->setPixmap(QPixmap::fromImage(QImage(":/about/About_pic.png")));
    QVBoxLayout *aboutLayout = new QVBoxLayout;
    aboutLayout->addWidget(about_pic);
    aboutLayout->addWidget(about_text);
    about->setLayout(aboutLayout);
    about->setFixedSize(400,400);
    about->show();
}
FlexibleHeader::FlexibleHeader( FlexibleView* parent )
    : FilterHeader( parent )
    , m_parent( parent )
{
    setFixedHeight( 80 );

    QFile f( RESPATH "stylesheets/topbar-radiobuttons.css" );
    f.open( QFile::ReadOnly );
    QString css = QString::fromLatin1( f.readAll() );
    f.close();

    QHBoxLayout* outerModeLayout = new QHBoxLayout;
    m_verticalLayout->addLayout( outerModeLayout );
    outerModeLayout->addSpacing( 156 );
    outerModeLayout->addStretch();

    QWidget* modeWidget = new QWidget( this );
    QHBoxLayout* modeLayout = new QHBoxLayout;
    modeWidget->setLayout( modeLayout );
    modeWidget->setStyleSheet( css );

    m_radioNormal = new QRadioButton( modeWidget );
    m_radioDetailed = new QRadioButton( modeWidget );
    m_radioCloud = new QRadioButton( modeWidget );
    //for the CSS:
    m_radioNormal->setObjectName( "radioNormal" );
    m_radioCloud->setObjectName( "radioCloud" );

    m_radioNormal->setFocusPolicy( Qt::NoFocus );
    m_radioDetailed->setFocusPolicy( Qt::NoFocus );
    m_radioCloud->setFocusPolicy( Qt::NoFocus );

    modeLayout->addWidget( m_radioNormal );
    modeLayout->addWidget( m_radioDetailed );
    modeLayout->addWidget( m_radioCloud );

    modeWidget->setFixedSize( 87, 30 );

    m_radioNormal->setChecked( true );

    outerModeLayout->addWidget( modeWidget );
    outerModeLayout->addStretch();

    TomahawkUtils::unmarginLayout( outerModeLayout );
    TomahawkUtils::unmarginLayout( modeLayout );

    if ( parent )
    {
        NewClosure( m_radioNormal,   SIGNAL( clicked() ), const_cast< FlexibleView* >( parent ), SLOT( setCurrentMode( FlexibleViewMode ) ), FlexibleView::Flat )->setAutoDelete( false );
        NewClosure( m_radioDetailed, SIGNAL( clicked() ), const_cast< FlexibleView* >( parent ), SLOT( setCurrentMode( FlexibleViewMode ) ), FlexibleView::Detailed )->setAutoDelete( false );
        NewClosure( m_radioCloud,    SIGNAL( clicked() ), const_cast< FlexibleView* >( parent ), SLOT( setCurrentMode( FlexibleViewMode ) ), FlexibleView::Grid )->setAutoDelete( false );
    }
}
void Configuration::findApplication(const QString &query)
{
    for (int i = (m_findApplicationUi.resultsLayout->count() - 1); i >= 0; --i)
    {
        m_findApplicationUi.resultsLayout->takeAt(i)->widget()->deleteLater();
        m_findApplicationUi.resultsLayout->removeItem(m_findApplicationUi.resultsLayout->itemAt(i));
    }

    if (query.length() < 3)
    {
        m_findApplicationDialog->adjustSize();

        return;
    }

    KService::List services = KServiceTypeTrader::self()->query("Application", QString("exist Exec and ( (exist Keywords and '%1' ~subin Keywords) or (exist GenericName and '%1' ~~ GenericName) or (exist Name and '%1' ~~ Name) )").arg(query));

    if (!services.isEmpty())
    {
        foreach (const KService::Ptr &service, services)
        {
            if (!service->noDisplay() && service->property("NotShowIn", QVariant::String) != "KDE")
            {
                Launcher* launcher = new Launcher(KUrl(service->entryPath()), m_applet);

                QWidget* entryWidget = new QWidget(static_cast<QWidget*>(parent()));
                QLabel* iconLabel = new QLabel(entryWidget);
                QLabel* textLabel = new QLabel(QString("%1<br /><small>%3</small>").arg(launcher->title()).arg(launcher->description()), entryWidget);

                iconLabel->setPixmap(launcher->icon().pixmap(32, 32));

                textLabel->setFixedSize(240, 40);

                QHBoxLayout* entryWidgetLayout = new QHBoxLayout(entryWidget);
                entryWidgetLayout->addWidget(iconLabel);
                entryWidgetLayout->addWidget(textLabel);
                entryWidgetLayout->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);

                entryWidget->setToolTip(QString("<b>%1</b><br /><i>%2</i>").arg(launcher->title()).arg(launcher->description()));
                entryWidget->setLayout(entryWidgetLayout);
                entryWidget->setFixedSize(300, 40);
                entryWidget->setObjectName(service->entryPath());
                entryWidget->installEventFilter(this);
                entryWidget->setCursor(QCursor(Qt::PointingHandCursor));

                m_findApplicationUi.resultsLayout->addWidget(entryWidget);

                delete launcher;
            }
        }
    }
Example #27
0
void DeviceSkin::loadImages()
{
    QImage iup = m_parameters.skinImageUp;
    QImage idown = m_parameters.skinImageDown;

    QImage iclosed;
    const bool hasClosedImage = !m_parameters.skinImageClosed.isNull();

    if (hasClosedImage)
	iclosed =  m_parameters.skinImageClosed;
    QImage icurs;
    const bool hasCursorImage = !m_parameters.skinCursor.isNull();
    if (hasCursorImage)
	icurs =  m_parameters.skinCursor;

    if (!transform.isIdentity()) {
	iup = iup.transformed(transform, Qt::SmoothTransformation);
	idown = idown.transformed(transform, Qt::SmoothTransformation);
	if (hasClosedImage)
	    iclosed = iclosed.transformed(transform, Qt::SmoothTransformation);
	if (hasCursorImage)
	    icurs = icurs.transformed(transform, Qt::SmoothTransformation);
    }
    const Qt::ImageConversionFlags conv = Qt::ThresholdAlphaDither|Qt::AvoidDither;
    skinImageUp = QPixmap::fromImage(iup);
    skinImageDown = QPixmap::fromImage(idown, conv);
    if (hasClosedImage)
	skinImageClosed = QPixmap::fromImage(iclosed, conv);
    if (hasCursorImage)
	skinCursor = QPixmap::fromImage(icurs, conv);

    setFixedSize( skinImageUp.size() );
    if (!skinImageUp.mask())
	skinImageUp.setMask(skinImageUp.createHeuristicMask());
    if (!skinImageClosed.mask())
	skinImageClosed.setMask(skinImageClosed.createHeuristicMask());

    QWidget* parent = parentWidget();
    parent->setMask( skinImageUp.mask() );
    parent->setFixedSize( skinImageUp.size() );

    delete cursorw;
    cursorw = 0;
    if (hasCursorImage) {
	cursorw = new qvfb_internal::CursorWindow(m_parameters.skinCursor, m_parameters.cursorHot, this);
	if ( m_view )
	    cursorw->setView(m_view);
    }
}
Example #28
0
void Ruler::createPlugin(QObject *parent, QString idParent,plugin::PluginsManager *manager)
{
    if(idParent == "Main")
    {
        mainWin = MAINWINDOW(parent);
        if(mainWin!=0)
        {
            painter = PAINTWIDGETINTERFACE(mainWin->getPaintWidget());

            realPainter = RPWINTEFACE(painter->getRealPaintWidget());
            selection = GSRINTEFACE(realPainter->getSelection());
            connect(selection,SIGNAL(moved(qreal,qreal)),this,SLOT(moveSelection(qreal,qreal)));

            // добавление линеек
            painter->mySetViewportMargins(RULER_BREADTH,RULER_BREADTH,0,0);
            QGridLayout* gridLayout = new QGridLayout();
            gridLayout->setSpacing(0);
            gridLayout->setMargin(0);
            mHorzRuler = new QDRuler(QDRuler::Horizontal,this);
            mVertRuler = new QDRuler(QDRuler::Vertical,this);
            QWidget* fake = new QWidget();
            fake->setBackgroundRole(QPalette::Window);
            fake->setFixedSize(RULER_BREADTH,RULER_BREADTH);
            gridLayout->addWidget(fake,0,0);
            gridLayout->addWidget(mHorzRuler,0,1);
            gridLayout->addWidget(mVertRuler,1,0);
            gridLayout->addWidget(painter->viewport(),1,1);
            painter->setLayout(gridLayout);

            for(int i=0; i<W_COUNT; i++)
            {
                WayLine *w = new WayLine(painter->viewport());
                w->setVisible(false);
                waylines.append(w);
            }

            // сигналы из внешнего мира
            connect(painter,SIGNAL(mouseMoveEvent(QPoint,QPoint,qreal)),this,SLOT(mouseMoveCoords(QPoint,QPoint,qreal)));
            connect(painter,SIGNAL(paintEvent(QPoint)),this,SLOT(mouseMoveOrigin(QPoint)));
            connect(painter,SIGNAL(zoomEvent(qreal)),this,SLOT(zoomEvent(qreal)));

            // коннекты для направляющих
            connect(mHorzRuler,SIGNAL(rulerClick(QPoint)),this,SLOT(rulerClickedH(QPoint)));
            connect(mVertRuler,SIGNAL(rulerClick(QPoint)),this,SLOT(rulerClickedV(QPoint)));

            manager->addPlugins(this, "Scale");
        }
    }
}
Example #29
0
SplashScreen::SplashScreen() : QSplashScreen(QPixmap(),Qt::WindowStaysOnTopHint)
{
  QFont titleFont = qApp->font();
  QFont authorFont = qApp->font();
  QFont versionFont = qApp->font();

  logo = new QPixmap(":/images/logo");

  QWidget *textWidget = new QWidget(this);
  QVBoxLayout *textLayout = new QVBoxLayout;
  Gui::ShadowedLabel *titleLabel = new Gui::ShadowedLabel(qApp->applicationName(),this);
  titleLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  titleFont.setBold(true);
  titleFont.setPointSize(40);
  titleLabel->setFont(titleFont);
  Gui::ShadowedLabel *versionLabel = new Gui::ShadowedLabel(qApp->applicationVersion(),this);
  versionFont.setPointSize(20);
  versionLabel->setFont(versionFont);
  versionLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  Gui::ShadowedLabel *authorLabel = new Gui::ShadowedLabel(tr("Author:") + " Antonio Di Monaco",this);
  authorFont.setPointSize(10);
  authorLabel->setFont(authorFont);
  authorLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  QWidget *spacerWidget = new QWidget(this);
  spacerWidget->setFixedHeight(15);

  textLayout->setSpacing(1);
  textLayout->addStretch();
  textLayout->addWidget(titleLabel);
  textLayout->addWidget(versionLabel);
  textLayout->addWidget(spacerWidget);
  textLayout->addWidget(authorLabel);

  textWidget->setLayout(textLayout);

  textWidget->setFixedSize(logo->size().width(),
                           logo->height() - QFontMetrics(qApp->font()).height() - 12);

  QPainter painter(logo);
  painter.setRenderHint(QPainter::Antialiasing,true);
  painter.setRenderHint(QPainter::TextAntialiasing,true);
  painter.fillRect(QRect(8,logo->height() - QFontMetrics(qApp->font()).height() - 12,
                         logo->width(),logo->height()),Qt::black);
  painter.end();
  textWidget->render(logo,QPoint(),QRegion(),0);

  setMask(QRegion(logo->mask()));
  setPixmap(*logo);
}
Example #30
0
HorizontalWidget::HorizontalWidget( QWidget* parent )
:QWidget( parent ), sphereRadio( 120.0 ), m_azimuth( 0 ), m_zenith( 0 )
{
	QVBoxLayout* mainLayout = new QVBoxLayout;
	setLayout( mainLayout );

	QWidget* examinerWidget = new QWidget;
	examinerWidget->setFixedSize( 490, 300 );
	mainLayout->addWidget(examinerWidget);

	m_rootNode = new SoSeparator;

	m_rootNode->addChild( Ejes( ) );
	m_rootNode->addChild( Text() );
    m_rootNode->addChild( Sphere() );
   	m_rootNode->addChild( Horizon() );
   	m_rootNode->addChild( AzimuthLine() );
   	m_rootNode->addChild( ZenithLine() );
    m_rootNode->addChild( Star() );

	SoQtExaminerViewer* myRenderArea = new SoQtExaminerViewer( examinerWidget );
    myRenderArea->setSceneGraph( m_rootNode );
    SbColor col( 0.86f, 0.86f, 0.86f );
    myRenderArea->setBackgroundColor(col);
    myRenderArea->show(  );

     QWidget* labelsWidget = new QWidget;
    mainLayout->addWidget( labelsWidget );

 	QGridLayout* labelsLayout = new QGridLayout;
 	labelsWidget->setLayout( labelsLayout );

 	QLabel* m_AzimuthLabel = new QLabel;
 	m_AzimuthLabel->setText( "Azimuth:" );
 	labelsLayout->addWidget( m_AzimuthLabel, 0, 0, 1, 1 );

	m_azimuthValue = new QLabel;
 	m_azimuthValue->setText( QString::number( m_azimuth ) );
 	labelsLayout->addWidget( m_azimuthValue, 0, 1, 1, 3  );

	QLabel* m_zenithLabel = new QLabel;
 	m_zenithLabel->setText( "Zenith:" );
 	labelsLayout->addWidget( m_zenithLabel, 1, 0, 1, 1 );

	m_zenithValue = new QLabel;
 	m_zenithValue->setText( QString::number( m_zenith ) );
 	labelsLayout->addWidget( m_zenithValue, 1, 1, 1, 3 );

}