Beispiel #1
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    //int scrW = QApplication::desktop()->screenGeometry().width();
    //int scrH = QApplication::desktop()->screenGeometry().height();
    ResourceFileReader *rfReader = new ResourceFileReader();

    int x, y, w, h, interval;
    QString source, mode, streamScriptDir;

    //
    // Check arguments
    //
    if ((argc - 1) == 5)
    {
        parseArgs(argv, &x, &y, &w, &h);
        rfReader->setResourceFile(argv[5]);
    }
    else
    {
        qDebug() << "Slideshow - revert to defaults";// Revert to defaults
        w = 1305; // Set fixed width to 500
        h = 734; // Old fixed height of the text script
        x = 0;
        y = 0;
        rfReader->setResourceFile("/home/pi/enter/resources/multimediawidget.xml");
    }

    mode = rfReader->getResource("mode");
    interval = rfReader->getResourceInt("slideshowInterval");
    streamScriptDir = rfReader->getResource("streamScriptDir");

    if(mode.compare("stream") == 0)
    {
        source = rfReader->getResource("streamURL");
    }
    else if(mode.compare("slideshow") == 0)
    {
        source = rfReader->getResource("multimediaPath");
    }

    MultimediaWidget *s = new MultimediaWidget(mode, source, interval, streamScriptDir);
    s->setDimensions(x, y, w, h);
    //show the images
    s->startWidget();
    QGraphicsView *view = new QGraphicsView(s->getScene());
    s->setView(view);

    //aesthetics: no scrollbars
    view->setGeometry(x, y, w, h);
    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setStyleSheet("background-color:white;");

    view->showNormal();

    return a.exec();
}
Beispiel #2
0
Dashboard::Dashboard(QWidget *parent)
    : QMainWindow(parent)
    , d_ptr(new DashboardPrivate(this))
{
    setWindowTitle("Maliit Keyboard Viewer");
    resize(854, 480);

    QGraphicsView *v = new QGraphicsView;
    v->setScene(new QGraphicsScene(v));
    v->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    v->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setCentralWidget(v);
    v->show();
    QWidget *w = 0;
    d_ptr->proxy_widget = v->scene()->addWidget(w = new QWidget);
    d_ptr->proxy_widget->setTransformOriginPoint(d_ptr->proxy_widget->geometry().center());
    w->resize(size());

    QVBoxLayout *vbox = d_ptr->vbox;
    w->setLayout(vbox);

    QSpacerItem *top_spacer = d_ptr->top;
    vbox->addItem(top_spacer);

    QWidget *buttons = d_ptr->buttons;
    buttons->show();
    vbox->addWidget(buttons);
    QHBoxLayout *hbox = new QHBoxLayout;
    buttons->setLayout(hbox);

    QPushButton *show = new QPushButton("Show virtual keyboard");
    connect(show, SIGNAL(clicked()),
            this, SLOT(onShow()));
    hbox->addWidget(show);
    show->show();

    QPushButton *orientation_changed = new QPushButton("Change orientation");
    connect(orientation_changed, SIGNAL(clicked()),
            this, SLOT(onOrientationChangeClicked()));
    hbox->addWidget(orientation_changed);
    orientation_changed->show();

    QPushButton *close = new QPushButton("Close application");
    connect(close, SIGNAL(clicked()),
            qApp,  SLOT(quit()));
    hbox->addWidget(close);
    close->show();

    QTextEdit *te = d_ptr->text_entry;
    vbox->addWidget(te);
    te->show();
    te->setFocus();

    QSpacerItem *bottom_spacer = d_ptr->bottom;
    vbox->addItem(bottom_spacer);

    onShow();
}
MainWindow::MainWindow()
{
    m_main = new MainArea();
    QGraphicsView* view = new QGraphicsView(m_main, this);
    view->setOptimizationFlags( QGraphicsView::DontClipPainter |
                                QGraphicsView::DontSavePainterState |
                                QGraphicsView::DontAdjustForAntialiasing );
//    view->setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
    view->setCacheMode( QGraphicsView::CacheBackground );
    view->setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
    view->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
    setCentralWidget(view);

    setupActions();

#ifndef Q_OS_QNX
    QLayout* l = layout();
    Q_ASSERT(l);
    l->setSizeConstraint(QLayout::SetFixedSize);

    // setup status bar
    KStatusBar* bar = statusBar();
    Q_ASSERT(bar);
    m_time_label = new QLabel("");
    bar->addPermanentWidget(m_time_label);

    m_balls_label = new QLabel("");
    bar->addWidget(m_balls_label);
//     bar->setItemAlignment(STATUSBAR_BALLS, Qt::AlignLeft);
#endif

    connect(m_main, SIGNAL(changeGameTime(int)), this, SLOT(setGameTime(int)));
    connect(m_main, SIGNAL(changeBallNumber(int)), this, SLOT(setBallNumber(int)));
    connect(m_main, SIGNAL(changeState(bool)), this, SLOT(changeState(bool)));
    connect(m_main, SIGNAL(pause(bool)), this, SLOT(pause(bool)));

#ifndef Q_OS_QNX
    stateChanged("playing", KXMLGUIClient::StateReverse);
#endif
    connect(m_main, SIGNAL(starting()), this, SLOT(newGame()));
    connect(m_main, SIGNAL(gameOver(int)), this, SLOT(gameOver(int)));

#ifndef Q_OS_QNX
    KGameDifficulty::init(this, this, SLOT(difficultyChanged(KGameDifficulty::standardLevel)));
    KGameDifficulty::setRestartOnChange(KGameDifficulty::RestartOnChange);
    KGameDifficulty::addStandardLevel(KGameDifficulty::Easy);
    KGameDifficulty::addStandardLevel(KGameDifficulty::Medium);
    KGameDifficulty::addStandardLevel(KGameDifficulty::Hard);
    KGameDifficulty::setLevel(KGameDifficulty::standardLevel(KollisionConfig::gameDifficulty()));
#endif

#ifdef Q_OS_QNX
    //setMinimumSize(m_main->sceneRect().size().toSize());
#endif
}
Beispiel #4
0
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{


    ui->setupUi(this);
    this->setWindowState(this->windowState() ^ Qt::WindowFullScreen);
    QGraphicsView *view = ui->graphicsView;
    view->setScene(&scene);

    view->setWindowFlags (Qt::FramelessWindowHint);
    view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    view->setRenderHint(QPainter::Antialiasing);

    view->setMaximumSize(size());
    view->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    view->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    view->setCacheMode(QGraphicsView::CacheBackground);


    QGMenu *menu = new QGMenu(view->rect());
    //menu->setOpacity(0);
    scene.addItem(menu);

    int size = 152 + 16;

    for (int i = 0; i < 20 ;i++) {
        int r = i / 5;
        int c = i % 5;
        QGTile *tile = new QGTile;
        scene.addItem(tile);
        tile->moveBy(c * size,  r * size);
        tile->installSceneEventFilter(menu);
    }
    menu->setZValue(100);

//    QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);

//    QTimeLine *timer = new QTimeLine(5000);
//    timer->setFrameRange(0, 100);

//    QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
//    animation->setItem(ball);
//    animation->setTimeLine(timer);

//    for (int i = 0; i < 200; ++i)
//        animation->setPosAt(i / 200.0, QPointF(i, i));

//    scene.addItem(ball);

//    timer->start();

}
void TimeGraphContainer::addGraphScene(GraphScene * scene) {
	scene->setTimeControl(time_widget->getTimeControl());

	QGraphicsView * v = new QGraphicsView();
	v->scale(1.0,-1.0); 
	v->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	v->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	list.append(v);
	v->setScene(scene); 
	inner_layout->addWidget(v);
	
}
Beispiel #6
0
// Constructor
AboutWindow::AboutWindow(QWidget *parent) : QDialog(parent)
{
   QGridLayout* layout = new QGridLayout( this );

   // Make the graphics view fixed size
   QGraphicsView* graphicsView = new QGraphicsView;
   graphicsView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
   graphicsView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
   graphicsView->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

   // Make the version text bold
   QLabel* appVersion = new QLabel( "Cache Simulator, Version 0.0.2" );
   QFont font;
   font.setPointSize( 10 );
   font.setBold( true );
   font.setWeight( 75 );
   appVersion->setFont( font );

   QLabel* descrip = new QLabel( HELP_TEXT );
   descrip->setWordWrap( true );

   QSpacerItem* vSpace = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );

   // Add widgets to the layout
   layout->addWidget( graphicsView, 0, 0, 2, 1 );
   layout->addWidget( appVersion, 0, 2, 1, 1 );
   layout->addWidget( descrip, 1, 2, 1, 1 );
   layout->addItem( vSpace, 1, 1, 1, 1 );

   // Position a picture of Dr. Plassmann's head over his shoulders
   _plassHead = new QGraphicsPixmapItem;
   _plassHead->setPixmap( QPixmap("PlassHead.png") );
   _plassHead->setTransformOriginPoint( _plassHead->pixmap().width()/2,
                                        _plassHead->pixmap().height()/2 );
   _plassHead->setPos( 30, 8 );
   _angle = 0;

   // Tell the view which scene to show
   QGraphicsScene* scene = new QGraphicsScene;
   scene->addPixmap( QPixmap("PlassGround.png") );
   scene->addItem( _plassHead );
   graphicsView->setScene( scene );

   // Set a timer to rotate Dr. Plassmann's head every 20 ms
   _rotateTimer = new QTimer( this );
   connect( _rotateTimer, SIGNAL(timeout()), this, SLOT(rotateHead()) );
   _angle = 720;
   _rotateTimer->start( 20 );

   // Do not allow resizing
   setFixedSize( this->sizeHint() );
}
Beispiel #7
0
void PTPSoCTestJigInterface2::enableRichGUI(){
	QWidget *m_objWidget=new QWidget(this);
	QGraphicsScene *entireScene = new QGraphicsScene(0,0,800,600);
	QGraphicsView  *entireView =  new QGraphicsView(m_objWidget);
	QPixmap obj1 = QPixmap(":/bg.png");
	QBrush obj2 = QBrush(obj1);
	obj2.setStyle(Qt::TexturePattern);
	obj2.setTexture(obj1);
	entireView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	entireView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	entireView->setFrameStyle(QFrame::Plain|QFrame::Sunken);
	entireView->setBackgroundBrush(obj2);
	entireView->setScene(entireScene);
	entireView->setGeometry(0,0,800,600);


	ui.groupBox_3->setParent(m_objWidget);
	ui.groupBox_4->setParent(m_objWidget);
	ui.groupBox_6->setParent(m_objWidget);
	ui.groupBox_7->setParent(m_objWidget);
	ui.groupBox_10->setParent(m_objWidget);
	ui.groupBox_11->setParent(m_objWidget);
	ui.groupBox_12->setParent(m_objWidget);
	ui.groupBox_13->setParent(m_objWidget);
	ui.groupBox_14->setParent(m_objWidget);
	ui.groupBox_15->setParent(m_objWidget);
	ui.label_9->setParent(m_objWidget);
    ui.comboBox_10->setParent(m_objWidget);
    ui.switchSRCIMP->setParent(m_objWidget);
    ui.switchFLY->setParent(m_objWidget);;

	ui.groupBox_3->setGeometry(10,10,161,70);
	ui.groupBox_4->setGeometry(180,10,161,71);
	ui.groupBox_6->setGeometry(350,10,161,70);
	ui.groupBox_7->setGeometry(10,180,771,211);
	ui.groupBox_10->setGeometry(10,90,391,80);
	ui.groupBox_11->setGeometry(420,90,151,80);
	ui.groupBox_12->setGeometry(590,90,191,80);
	ui.groupBox_13->setGeometry(590,200,170,61);
	ui.groupBox_14->setGeometry(520,10,261,70);
	ui.groupBox_15->setGeometry(10,400,321,80);
	ui.label_9->setGeometry(500,410,251,20);
    ui.comboBox_10->setGeometry(40,430,125,30);
    ui.switchSRCIMP->setGeometry(210,426,84,40);
    ui.switchFLY->setGeometry(350,426,111,40);

    m_objWidget->setStyleSheet("QLabel{color:white;}");

}
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QDir::setCurrent(QCoreApplication::applicationDirPath());
    QDir dir(QDir::current());

    // set the slide model.
    QFile xmlf(dir.absoluteFilePath("userdata/test.xml"));
    if (!xmlf.exists()) {
        QMessageBox::critical(0, "error", "no xml file...");
        return 0;
    }
    xmlf.open(QFile::ReadWrite);
    QSlideModel model(xmlf.readAll());
    xmlf.close();


    // set the slide scene
    QSlidePlayerScene *scene = new QSlidePlayerScene(0, &model);
    QPixmap pixmap(dir.absoluteFilePath("res/images/default-background.png"));
    scene->setBackgroundBrush(Qt::black);
    scene->setBackgroundPixmap(pixmap);

    //set slide view
    QGraphicsView *view = new QGraphicsView(scene);

    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setFrameShape(QFrame::NoFrame);
    // editing is not allowed.
    view->setInteractive(false);

    // scale
    double newScale = QApplication::desktop()->height() / scene->sceneRect().height();
    QMatrix oldMatrix = view->matrix();
    view->resetMatrix();
    view->translate(oldMatrix.dx(), oldMatrix.dy());
    view->scale(newScale, newScale);

    view->showFullScreen();

    QHidDevice * test = new QHidDevice(0x55, 0x32, &a);

    return a.exec();
}
Beispiel #9
0
Game::Game(QWidget *parent)
{
    QRect rec = QApplication::desktop()->screenGeometry();
    int height = rec.height();
    int width = rec.width();

    QGraphicsScene *scene = new QGraphicsScene();
    scene->setSceneRect(0,0,width,height);

    QGraphicsView *view = new QGraphicsView(scene);

    scene->setBackgroundBrush(QImage("://img/bg.png"));

    //player
    ship *player=new ship();
    scene->addItem(player);
    player->setPos(width/2, height-70);

    //scoring
    score = new Score();
    scene->addItem(score);

    //life
    life = new Life();
    life->setPos(life->x(),life->y()+25);
    scene->addItem(life);

    player->setFlag(QGraphicsItem::ItemIsFocusable);
    player->setFocus();

    //enemies
    QTimer*timer=new QTimer();
    QObject::connect(timer,SIGNAL(timeout()),player,SLOT(spawn()));
    timer->start(2000);

    //music
    QMediaPlayer * music = new QMediaPlayer();
    music->setMedia(QUrl("qrc:/sounds/bgmusic.mp3"));
    music->play();

    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->showFullScreen();
}
Beispiel #10
0
void ADHighAccuracy::enableRichGUI(){
	QWidget *m_objWidget=new QWidget(this);
	QGraphicsScene *entireScene = new QGraphicsScene(0,0,800,600);
	QGraphicsView  *entireView =  new QGraphicsView(m_objWidget);
	QPixmap obj1 = QPixmap(":/bg.png");
	QBrush obj2 = QBrush(obj1);
	obj2.setStyle(Qt::TexturePattern);
	obj2.setTexture(obj1);
	entireView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	entireView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	entireView->setFrameStyle(QFrame::Plain|QFrame::Sunken);
	entireView->setBackgroundBrush(obj2);
	entireView->setScene(entireScene);
	entireView->setGeometry(0,0,800,600);

	ui->groupBox->setParent(m_objWidget);
	ui->groupBox_2->setParent(m_objWidget);
	ui->groupBox_3->setParent(m_objWidget);
	ui->groupBox_57->setParent(m_objWidget);
	ui->groupBox_62->setParent(m_objWidget);
	ui->groupBox_63->setParent(m_objWidget);
	ui->groupBox_64->setParent(m_objWidget);
	ui->groupBox_65->setParent(m_objWidget);
	ui->groupBox_66->setParent(m_objWidget);
	ui->groupBox_67->setParent(m_objWidget);
//	ui->groupBox_68->setParent(m_objWidget);
	ui->GPCon->setParent(m_objWidget);
        ui->settings->setParent(m_objWidget);

	ui->groupBox->setGeometry(585,288,197,99);
	ui->groupBox_2->setGeometry(663,459,118,63);
	ui->groupBox_3->setGeometry(340,390,440,60);
	ui->groupBox_57->setGeometry(10,0,321,281);
	ui->groupBox_62->setGeometry(10,280,321,161);
        ui->groupBox_63->setGeometry(10,440,230,81);
	ui->groupBox_64->setGeometry(340,0,231,201);
	ui->groupBox_65->setGeometry(340,200,231,80);
	ui->groupBox_66->setGeometry(340,280,241,91);
	ui->groupBox_67->setGeometry(580,0,201,281);
//	ui->groupBox_68->setGeometry(320,450,341,71);
	ui->GPCon->setGeometry(320,450,341,71);
        ui->settings->setGeometry(240,450,70,70);
}
Beispiel #11
0
/*Tutorial:
QGraphicsScene: world, player (Inivisble ~concept)
QGraphicsItem(QGraphicsRectitem): goes into scene
QGraphicsView:
*/
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    //Create a scene
    QGraphicsScene *scene  = new QGraphicsScene();

    //Create an item to put into the scene
    MyRect *rect = new MyRect();

    rect->setRect(0,0,100,100); //(x,y,width,height)

    //Add item to the Scene
    scene->addItem(rect);

    //Make Rect focusable
    rect->setFlag(QGraphicsItem::ItemIsFocusable); //Only one focused item at a time
                                                   //Allowing rect to be focusable
    rect->setFocus(); //Setting rect item to focus

    //Add a view
    QGraphicsView *view = new QGraphicsView(scene); //Initializing in constructor
    //view->setScene(scene); alternative

    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    view->show();

    view->setFixedSize(800,600);
    scene->setSceneRect(0,0,800,600);

    rect->setPos(view->width()/2,view->height() - rect->rect().height());

    //Spawn Enemies
    QTimer *timer = new QTimer();
    QObject::connect(timer,SIGNAL(timeout()),rect,SLOT(spawn()));
    timer->start(2000);

    return a.exec();
}
Beispiel #12
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // Create a scene
    QGraphicsScene * mygamescene = new QGraphicsScene();
    MyRect * player = new MyRect();
    player->setRect(0,0,50,50);
    mygamescene->addItem(player);
    // Make rect respond to events
    player->setFlag(QGraphicsItem::ItemIsFocusable);
    player->setFocus();
    QGraphicsView * myview = new QGraphicsView(mygamescene);
    myview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    myview->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    myview->show();
    myview->setFixedSize(800,600);
    mygamescene->setSceneRect(0,0,800,600);
    player->setPos((myview->width()-player->rect().width())/2,myview->height()-player->rect().height());
    return a.exec();
}
Beispiel #13
0
void Widget::enableRichGUI() {
	QWidget *m_objWidget = new QWidget(this);
	QGraphicsScene *entireScene = new QGraphicsScene(0, 0, 800, 600);
	QGraphicsView *entireView = new QGraphicsView(m_objWidget);
	QPixmap obj1 = QPixmap(":/bg.png");
	QBrush obj2 = QBrush(obj1);
	obj2.setStyle(Qt::TexturePattern);
	obj2.setTexture(obj1);
	entireView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	entireView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	entireView->setFrameStyle(QFrame::Plain | QFrame::Sunken);
	entireView->setBackgroundBrush(obj2);
	entireView->setScene(entireScene);
	entireView->setGeometry(0, 0, 800, 600);

	ui->grpGeneral->setParent(m_objWidget);
	ui->tableWidget->setParent(m_objWidget);

	ui->grpGeneral->setGeometry(20, 10, 310, 181);
        ui->tableWidget->setGeometry(400, 20, 320, 490);

}
void PieceAppearanceWidget::setupUI()
{
    QLayout * lay = new QGridLayout( this );
    lay->setSpacing(0);
    lay->setContentsMargins(0,0,0,0);
    QGraphicsView * v = this->impl->gv =
	//new QGraphicsView( impl->gs.scene() )
	new QBoardView( impl->gs )
	;

    v->setTransformationAnchor(QGraphicsView::NoAnchor);
#if 0
    v->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    v->setInteractive(true); // required to get mouse events to the children
    v->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
    v->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
    v->setDragMode(QGraphicsView::RubberBandDrag);
    v->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
#endif
    v->setBackgroundBrush(QColor("#abb8fb"));
    v->viewport()->setObjectName( "PieceAppearanceWidget");

    lay->addWidget( v );

    QStringList tip;
    tip << "<html><body>These widgets are appearance templates for game pieces.\n"
	<< "Edit them by right-clicking them.\n"
	<< "Select a template by left-clicking it. "
	<< "QBoard will use the selected template as the default look\n"
	<< "for newly-added pieces which are loaded from image files.\n"
	<< "This list will be saved automatically when QBoard exits,\n"
	<< "and loaded when QBoard starts up.</body></html>"
	;
    impl->gv->setToolTip( tip.join("") );

}
Beispiel #15
0
void DDSWidget::enableRichGUI() {
	QWidget *m_objWidget = new QWidget(this);
	QGraphicsScene *entireScene = new QGraphicsScene(0, 0, 800, 600);
	QGraphicsView *entireView = new QGraphicsView(m_objWidget);
	QPixmap obj1 = QPixmap(":/bg.png");
	QBrush obj2 = QBrush(obj1);
	obj2.setStyle(Qt::TexturePattern);
	obj2.setTexture(obj1);
	entireView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	entireView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	entireView->setFrameStyle(QFrame::Plain | QFrame::Sunken);
	entireView->setBackgroundBrush(obj2);
	entireView->setScene(entireScene);
	entireView->setGeometry(0, 0, 800, 600);

	ui->grpBarRep->setParent(m_objWidget);
	ui->grpDDS->setParent(m_objWidget);
	ui->grpDrive->setParent(m_objWidget);
	ui->grpGeneral->setParent(m_objWidget);
	ui->grpPPT->setParent(m_objWidget);
	ui->grpTimeBase->setParent(m_objWidget);
	ui->grpAD5293->setParent(m_objWidget);

	ui->grpGeneral->setGeometry(10, 10, 280, 121);
        ui->grpTimeBase->setGeometry(310, 10, 471, 187);
        ui->grpDDS->setGeometry(10, 200, 280, 320);
        ui->grpPPT->setGeometry(310, 200, 470, 130);
        ui->grpDrive->setGeometry(310, 460, 470, 60);
        ui->grpBarRep->setGeometry(310, 333, 470, 130);
        ui->grpAD5293->setGeometry(10, 130, 281, 71);

	m_objLE_ADDR->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;");
	m_objLE_DATA->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;");
	m_objLE_BTU->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;");
	m_objLE_BD->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;");
	m_objLE_OPFreq->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;");
	m_objLE_OPPhase->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;");
	m_objLE_STDLY->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;");
	m_objLE_WDP->setStyleSheet(
                "QLineEdit{border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;}QLineEdit::disabled{border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: dark gray;     selection-background-color: yellow;   color:white;     font: bold 14px;}");
	m_objLE_STOPDLY->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;");
	m_objLE_DPC->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;");
        m_objLE_DDSCycle->setStyleSheet(
                "QLineEdit{border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;}QLineEdit::disabled{border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: dark gray;     selection-background-color: yellow;   color:white;     font: bold 14px;}");
        m_objLE_DDSVoltage->setStyleSheet(
                "QLineEdit{border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: black;     selection-background-color: yellow;   color:white;     font: bold 14px;}QLineEdit::disabled{border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: dark gray;     selection-background-color: yellow;   color:white;     font: bold 14px;}");
	ui->leFS->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: gray;     selection-background-color: yellow;   color:yellow;     font: bold 14px;");
	ui->leOutputTime->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: gray;     selection-background-color: yellow;   color:yellow;     font: bold 14px;");
	ui->leTickFrequency->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: gray;     selection-background-color: yellow;   color:yellow;     font: bold 14px;");
	ui->leTickTime->setStyleSheet(
			"border-width: 2px;border-style: outset;border-color: gray; border-radius: 10px;  padding: 0 8px;     background: gray;     selection-background-color: yellow;   color:yellow;     font: bold 14px;");

}
Beispiel #16
0
/* GameBored contstructor
 * @param QWidget is the parent widget
*/
GameBored::GameBored(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::GameBored)
{
    ui->setupUi(this);

    // make scene
    QGraphicsScene * scene= new QGraphicsScene();
    scene->setSceneRect(0,0,800,600);
    scene->setBackgroundBrush(QBrush(QImage(":/pics/bg")));


    // make and add item to scene
    MyRect * player = new MyRect();
    scene->addItem(player);

    // focus item so that it can receive keyboard events
    player->setFlag(QGraphicsItem::ItemIsFocusable);
    player->setFocus();


    // add scene to new view
    QGraphicsView * view = new QGraphicsView(scene);

    //turn off scrollbars
    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);


    Board= new QWidget;
    //Board->setFixedSize(400,400);

    // add view to new layout
    // add layout to central widget
    QVBoxLayout * vlayout = new QVBoxLayout(Board);
    vlayout->addWidget(view);
    this->setLayout(vlayout);

    //
    this->show();
    view->setFixedSize(800,600);
    scene->setSceneRect(0,0,800,600);

    player->setPos(view->width()/2 -player->pixmap().width()/2, -28 /*view->height()- player->pixmap().height()*/);

    // constant creation of enemies
    QTimer* timer = new QTimer();
    QObject::connect(timer,SIGNAL(timeout()),player,SLOT(spawn()));
    timer->start(2400);

    QTimer* timer2 = new QTimer();
    QObject::connect(timer2,SIGNAL(timeout()),player,SLOT(spawn2()));
    timer2->start(5000);


    // play music
    mp3player = new QMediaPlayer();
    mp3player->setMedia(QUrl("qrc:/audio/starfox.mp3"));
    mp3player->play();

    // add score class to screen
    score = new Score();
    scene->addItem(score);
}
void JobViewServer::setupUi() {

  // Paar allgemeine Parameter
  setBackgroundHints(DefaultBackground);
  setHasConfigurationInterface(true);
  setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
  resize(400, 80);

  // Rahmen, der das Hauptlayout enthält
  Plasma::Frame* frame = new Plasma::Frame();
  frame->setFrameShadow(Plasma::Frame::Sunken);
  QGraphicsLinearLayout* fullSpaceLayout = new QGraphicsLinearLayout();
  fullSpaceLayout->setContentsMargins(0,0,0,0);
  setLayout(fullSpaceLayout);
  fullSpaceLayout->addItem(frame);
  QGraphicsLinearLayout* layout = new QGraphicsLinearLayout();
  layout->setContentsMargins(0,0,0,0);
  frame->setLayout(layout);

  // Icon mit History und Queue Indicator
  iconWidget = new Plasma::IconWidget();
  iconWidget->setPreferredWidth(25);
  iconWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
  iconWidget->setIcon(KIcon("arrow-down"));
  layout->addItem(iconWidget);

  // Layout mit Progressbars
  meterContainer = new Plasma::Label();
  meterContainer->nativeWidget()->setWordWrap(true);
  meterLayout = new QGraphicsLinearLayout();
  meterContainer->setLayout(meterLayout);
  layout->addItem(meterContainer);

  // Popup erzeugen
  popup = new Plasma::Dialog();
  QVBoxLayout* popupLayout = new QVBoxLayout();
  popupLayout->setContentsMargins(0,0,0,0);
  popup->setLayout(popupLayout);
  popup->setWindowFlags(Qt::Popup);
  popup->resize(400, 300);

  // GraphicsView und GraphicsScene erzeugen
  QGraphicsScene* popupScene = new QGraphicsScene();
  QGraphicsView* popupView = new QGraphicsView();
  popupView->setScene(popupScene);
  popupView->setFrameStyle(QFrame::NoFrame);
  popupView->setStyleSheet("background-color: transparent;");
  popupView->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
  popupView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  popupView->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  popupLayout->addWidget(popupView);

  // Container mit dem GridLayout zur Scene hinzufügen
  jobViewContainer = new QGraphicsWidget();
  jobViewLayout = new QGraphicsLinearLayout(Qt::Vertical);
  jobViewLayout->setContentsMargins(5,5,5,5);
  jobViewContainer->setLayout(jobViewLayout);
  popupScene->addItem(jobViewContainer);

  // Überschrift-/Nachrichtenbereich
  popupHeadline = new Plasma::Label();
  popupHeadline->nativeWidget()->setAlignment(Qt::AlignCenter);
  jobViewLayout->addItem(popupHeadline);

  QObject::connect(iconWidget, SIGNAL(clicked()), this, SLOT(showPopup()));
}