Esempio n. 1
1
BalloonMsg::BalloonMsg(void *param, const QString &_text, QStringList &btn, QWidget *parent, const QRect *rcParent,
                       bool bModal, bool bAutoHide, unsigned bwidth, const QString &box_msg, bool *bChecked)
        : QDialog(parent, "ballon", bModal,
                  (bAutoHide ? WType_Popup : WType_TopLevel | WStyle_StaysOnTop)
                  | WStyle_Customize | WStyle_NoBorderEx | WStyle_Tool | WDestructiveClose | WX11BypassWM)
{
    m_param = param;
    m_parent = parent;
    m_width = bwidth;
    m_bAutoHide = bAutoHide;
    m_bYes = false;
    m_bChecked = bChecked;
    bool bTailDown = true;
    setPalette(QToolTip::palette());
    text = _text;
    QFrame *frm = new QFrame(this);
    frm->setPalette(palette());
    QVBoxLayout *vlay = new QVBoxLayout(frm);
    vlay->setMargin(0);
    m_check = NULL;
    if (!box_msg.isEmpty()){
        m_check = new QCheckBox(box_msg, frm);
        vlay->addWidget(m_check);
        if (m_bChecked)
            m_check->setChecked(*m_bChecked);
    }
    QHBoxLayout *lay = new QHBoxLayout(vlay);
    lay->setSpacing(5);
    lay->addStretch();
    unsigned id = 0;
    bool bFirst = true;
    for (QStringList::Iterator it = btn.begin(); it != btn.end(); ++it, id++){
        BalloonButton *b = new BalloonButton(*it, frm, id);
        connect(b, SIGNAL(action(int)), this, SLOT(action(int)));
        lay->addWidget(b);
        if (bFirst){
            b->setDefault(true);
            bFirst = false;
        }
    }
    setButtonsPict(this);
    lay->addStretch();
    int wndWidth = frm->minimumSizeHint().width();
    int hButton  = frm->minimumSizeHint().height();

    int txtWidth = bwidth;
    QRect rc;
    if (rcParent){
        rc = *rcParent;
    }else{
        QPoint p = parent->mapToGlobal(parent->rect().topLeft());
        rc = QRect(p.x(), p.y(), parent->width(), parent->height());
    }
    if (rc.width() > txtWidth) txtWidth = rc.width();

    QSimpleRichText richText(_text, font(), "", QStyleSheet::defaultSheet(), QMimeSourceFactory::defaultFactory(), -1, Qt::blue, false);
    richText.setWidth(wndWidth);
    richText.adjustSize();
    QSize s(richText.widthUsed(), richText.height());
    QSize sMin = frm->minimumSizeHint();
    if (s.width() < sMin.width())
        s.setWidth(sMin.width());
    int BALLOON_SHADOW = BALLOON_SHADOW_DEF;
#ifdef WIN32
	/* FIXME */
/*    if ((GetClassLong(winId(), GCL_STYLE) & CS_DROPSHADOW) && style().inherits("QWindowsXPStyle"))
        BALLOON_SHADOW = 0; */
#endif
    resize(s.width() + BALLOON_R * 2 + BALLOON_SHADOW,
           s.height() + BALLOON_R * 2 + BALLOON_TAIL + BALLOON_SHADOW + hButton + BALLOON_MARGIN);
    mask = QBitmap(width(), height());
    int w = width() - BALLOON_SHADOW;
    int tailX = w / 2;
    int posX = rc.left() + rc.width() / 2 + BALLOON_TAIL_WIDTH - tailX;
    if (posX <= 0) posX = 1;
    QRect rcScreen = screenGeometry();
    if (posX + width() >= rcScreen.width())
        posX = rcScreen.width() - 1 - width();
    int tx = posX + tailX - BALLOON_TAIL_WIDTH;
    if (tx < rc.left()) tx = rc.left();
    if (tx > rc.left() + rc.width()) tx = rc.left() + rc.width();
    tailX = tx + BALLOON_TAIL_WIDTH - posX;
    if (tailX < BALLOON_R) tailX = BALLOON_R;
    if (tailX > width() - BALLOON_R - BALLOON_TAIL_WIDTH) tailX = width() - BALLOON_R - BALLOON_TAIL_WIDTH;
    if (rc.top() <= height() + 2){
        bTailDown = false;
        move(posX, rc.top() + rc.height() + 1);
    }else{
        move(posX, rc.top() - height() - 1);
    }
    int pos = 0;
    int h = height() - BALLOON_SHADOW - BALLOON_TAIL;
    if (!bTailDown) pos += BALLOON_TAIL;
    textRect.setRect(BALLOON_R, pos + BALLOON_R, w - BALLOON_R * 2, h);
    frm->resize(s.width(), hButton);
    frm->move(BALLOON_R, pos + h - BALLOON_R - hButton);
    QPainter p;
    p.begin(&mask);
#ifdef WIN32
    QColor bg(255, 255, 255);
    QColor fg(0, 0, 0);
#else
    QColor bg(0, 0, 0);
    QColor fg(255, 255, 255);
#endif
    p.fillRect(0, 0, width(), height(), bg);
    p.fillRect(0, pos + BALLOON_R, w, h - BALLOON_R * 2, fg);
    p.fillRect(BALLOON_R, pos, w - BALLOON_R * 2, h, fg);
    p.fillRect(BALLOON_SHADOW, pos + BALLOON_R + BALLOON_SHADOW, w, h - BALLOON_R * 2, fg);
    p.fillRect(BALLOON_R + BALLOON_SHADOW, pos + BALLOON_SHADOW, w - BALLOON_R * 2, h, fg);
    p.setBrush(fg);
    p.drawEllipse(0, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(0, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(BALLOON_SHADOW, pos + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2 + BALLOON_SHADOW, pos + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2 + BALLOON_SHADOW, pos + h - BALLOON_R * 2 + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(BALLOON_SHADOW, pos + h - BALLOON_R * 2 + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    QPointArray arr(3);
    arr.setPoint(0, tailX, bTailDown ? h : pos);
    arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH, bTailDown ? h : pos);
    arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH, bTailDown ? height() - BALLOON_SHADOW : 0);
    p.drawPolygon(arr);
    arr.setPoint(0, tailX + BALLOON_SHADOW, (bTailDown ? h : pos) + BALLOON_SHADOW);
    arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH + BALLOON_SHADOW, (bTailDown ? h : pos) + BALLOON_SHADOW);
    arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH + BALLOON_SHADOW, bTailDown ? height() : BALLOON_SHADOW);
    p.drawPolygon(arr);
    p.end();
    setMask(mask);
    qApp->syncX();
    QPixmap pict = QPixmap::grabWindow(QApplication::desktop()->winId(), x(), y(), width(), height());
    intensity(pict, -0.50f);
    p.begin(&pict);
    p.setBrush(colorGroup().background());
    p.drawEllipse(0, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(0, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    arr.setPoint(0, tailX, bTailDown ? h - 1 : pos + 1);
    arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH, bTailDown ? h - 1 : pos + 1);
    arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH, bTailDown ? height() - BALLOON_SHADOW : 0);
    p.drawPolygon(arr);
    p.fillRect(0, pos + BALLOON_R, w, h - BALLOON_R * 2, colorGroup().background());
    p.fillRect(BALLOON_R, pos, w - BALLOON_R * 2, h, colorGroup().background());
    p.drawLine(0, pos + BALLOON_R, 0, pos + h - BALLOON_R);
    p.drawLine(w - 1, pos + BALLOON_R, w - 1, pos + h - BALLOON_R);
    if (bTailDown){
        p.drawLine(BALLOON_R, 0, w - BALLOON_R, 0);
        p.drawLine(BALLOON_R, h - 1, tailX, h - 1);
        p.drawLine(tailX + BALLOON_TAIL_WIDTH, h - 1, w - BALLOON_R, h - 1);
    }else{
        p.drawLine(BALLOON_R, pos + h - 1, w - BALLOON_R, pos + h - 1);
        p.drawLine(BALLOON_R, pos, tailX, pos);
        p.drawLine(tailX + BALLOON_TAIL_WIDTH, pos, w - BALLOON_R, pos);
    }
    p.end();
    setBackgroundPixmap(pict);
    setAutoMask(true);
    if (!bAutoHide)
        setFocusPolicy(NoFocus);

    QWidget *top = NULL;
    if (parent)
        top = parent->topLevelWidget();
    if (top){
        raiseWindow(top);
        top->installEventFilter(this);
    }
}
CKeyReferenceWidget::CKeyReferenceWidget( CSwordBibleModuleInfo *mod, CSwordVerseKey *key, QWidget *parent, const char* /*name*/) :
        QWidget(parent),
        m_key(key),
        m_dropDownHoverTimer(this) {
    namespace DU = util::directory;

    updatelock = false;
    m_module = mod;

    setFocusPolicy(Qt::WheelFocus);

    QToolButton* clearRef = new QToolButton(this);
    clearRef->setIcon(DU::getIcon("edit_clear_locationbar"));
    clearRef->setAutoRaise(true);
    clearRef->setStyleSheet("QToolButton{margin:0px;}");
    connect(clearRef, SIGNAL(clicked()), SLOT(slotClearRef()) );

    m_bookScroller = new CScrollerWidgetSet(this);

    m_textbox = new BtLineEdit( this );
    setFocusProxy(m_textbox);
    m_textbox->setContentsMargins(0, 0, 0, 0);

    setKey(key);	// The order of these two functions is important.
    setModule();

    m_chapterScroller = new CScrollerWidgetSet(this);
    m_verseScroller = new CScrollerWidgetSet(this);

    QHBoxLayout* m_mainLayout = new QHBoxLayout( this );
    m_mainLayout->setContentsMargins(0, 0, 0, 0);
    m_mainLayout->setSpacing(0);
    m_mainLayout->addWidget(clearRef);
    m_mainLayout->addWidget(m_bookScroller);
    m_mainLayout->addWidget(m_textbox);
    m_mainLayout->addWidget(m_chapterScroller);
    m_mainLayout->addWidget(m_verseScroller);


    setTabOrder(m_textbox, 0);
    m_dropDownButtons = new QWidget(0);
    m_dropDownButtons->setWindowFlags(Qt::Popup);
    m_dropDownButtons->setAttribute(Qt::WA_WindowPropagation);
    m_dropDownButtons->setCursor(Qt::ArrowCursor);
    QHBoxLayout *dropDownButtonsLayout(new QHBoxLayout(m_dropDownButtons));
    m_bookDropdownButton = new BtBookDropdownChooserButton(this);
    dropDownButtonsLayout->addWidget(m_bookDropdownButton, 2);
    m_chapterDropdownButton = new BtChapterDropdownChooserButton(this);
    dropDownButtonsLayout->addWidget(m_chapterDropdownButton, 1);
    m_verseDropdownButton = new BtVerseDropdownChooserButton(this);
    dropDownButtonsLayout->addWidget(m_verseDropdownButton, 1);
    dropDownButtonsLayout->setContentsMargins(0, 0, 0, 0);
    dropDownButtonsLayout->setSpacing(0);
    m_dropDownButtons->setLayout(dropDownButtonsLayout);
    m_dropDownButtons->hide();

    m_dropDownButtons->installEventFilter(this);

    m_dropDownHoverTimer.setInterval(500);
    m_dropDownHoverTimer.setSingleShot(true);
    connect(&m_dropDownHoverTimer, SIGNAL(timeout()),
            m_dropDownButtons, SLOT(hide()));

    QString scrollButtonToolTip(tr("Scroll through the entries of the list. Press the button and move the mouse to increase or decrease the item."));
    m_bookScroller->setToolTips(
        tr("Next book"),
        scrollButtonToolTip,
        tr("Previous book")
    );
    m_chapterScroller->setToolTips(
        tr("Next chapter"),
        scrollButtonToolTip,
        tr("Previous chapter")
    );
    m_verseScroller->setToolTips(
        tr("Next verse"),
        scrollButtonToolTip,
        tr("Previous verse")
    );

    // signals and slots connections

    connect(m_bookScroller, SIGNAL(change(int)), SLOT(slotStepBook(int)));
    connect(m_bookScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock()));
    connect(m_bookScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock()));
    connect(m_textbox, SIGNAL(returnPressed()), SLOT(slotReturnPressed()));
    connect(m_chapterScroller, SIGNAL(change(int)), SLOT(slotStepChapter(int)));
    connect(m_chapterScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock()));
    connect(m_chapterScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock()));
    connect(m_verseScroller, SIGNAL(change(int)), SLOT(slotStepVerse(int)));
    connect(m_verseScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock()));
    connect(m_verseScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock()));
}
Esempio n. 3
0
SpikePlot_CV::SpikePlot_CV(SignalProcessor *inSignalProcessor, SignalChannel *initialChannel,
                     ConductionVelocityDialog *inConductionVelocityDialog, QWidget *parent) :
    QWidget(parent)
{
    signalProcessor = inSignalProcessor;
    conductionVelocityDialog = inConductionVelocityDialog;

    selectedChannel = initialChannel;
    startingNewChannel = true;
    rmsDisplayPeriod = 0;
    savedRms = 0.0;

    spikeWaveformIndex = 0;
    numSpikeWaveforms = 0;
    maxNumSpikeWaveforms = 20;
    voltageTriggerMode = true;
    voltageThreshold = 0;
    digitalTriggerChannel = 0;
    digitalEdgePolarity = true;

    setBackgroundRole(QPalette::Window);
    setAutoFillBackground(true);
    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    setFocusPolicy(Qt::StrongFocus);

    int i;

    // We can plot up to 30 superimposed spike waveforms on the scope.
    spikeWaveform.resize(30);
    for (i = 0; i < spikeWaveform.size(); ++i) {
        // Each waveform is 3 ms in duration.  We need 91 time steps for a 3 ms
        // waveform with the sample rate is set to its maximum value of 30 kS/s.
        spikeWaveform[i].resize(91);
        spikeWaveform[i].fill(0.0);
    }

    // Buffers to hold recent history of spike waveform and digital input,
    // used to find trigger events.
    spikeWaveformBuffer.resize(10000);
    spikeWaveformBuffer.fill(0.0);
    digitalInputBuffer.resize(10000);
    digitalInputBuffer.fill(0);

    // Set up vectors of varying plot colors so that older waveforms
    // are plotted in low-contrast gray and new waveforms are plotted
    // in high-contrast blue.  Older signals fade away, like phosphor
    // traces on old-school CRT oscilloscopes.
    scopeColors.resize(3);
    scopeColors[0].resize(10);
    scopeColors[1].resize(20);
    scopeColors[2].resize(30);

    for (i = 6; i < 10; ++i) scopeColors[0][i] = Qt::blue;
    for (i = 3; i < 6; ++i) scopeColors[0][i] = Qt::darkGray;
    for (i = 0; i < 3; ++i) scopeColors[0][i] = Qt::lightGray;

    for (i = 12; i < 20; ++i) scopeColors[1][i] = Qt::blue;
    for (i = 6; i < 12; ++i) scopeColors[1][i] = Qt::darkGray;
    for (i = 0; i < 6; ++i) scopeColors[1][i] = Qt::lightGray;

    for (i = 18; i < 30; ++i) scopeColors[2][i] = Qt::blue;
    for (i = 9; i < 18; ++i) scopeColors[2][i] = Qt::darkGray;
    for (i = 0; i < 9; ++i) scopeColors[2][i] = Qt::lightGray;

    // Default values that may be overwritten.
    yScale = 5000;
    setSampleRate(30000.0);
}
setColValuesDialog::setColValuesDialog( ScriptingEnv *env, QWidget* parent,  const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
  scriptEnv = env;
    if ( !name )
	setName( "setColValuesDialog" );
    setCaption( tr( "QtiPlot - Set column values" ) );
    setFocusPolicy( QDialog::StrongFocus );
	
	QHBox *hbox1=new QHBox (this, "hbox1"); 
	hbox1->setSpacing (5);
	
	QVBox *box1=new QVBox (hbox1, "box2"); 
	box1->setSpacing (5);

	explain = new QTextEdit(box1, "explain" );
	explain->setReadOnly (true);
	explain->setPaletteBackgroundColor(QColor(197, 197, 197));
	
	colNameLabel = new QLabel(box1, "colNameLabel" );

	QVBox *box2=new QVBox (hbox1, "box2"); 
	box2->setMargin(5);
	box2->setFrameStyle (QFrame::Box);

	QHBox *hbox2=new QHBox (box2, "hbox2"); 
	hbox2->setMargin(5);
	hbox2->setSpacing (5);
	
	QLabel *TextLabel1 = new QLabel(hbox2, "TextLabel1" );
    TextLabel1->setText( tr( "For row (i)" ) );
	
	start = new QSpinBox(hbox2, "start" );
   
    QLabel *TextLabel2 = new QLabel(hbox2, "TextLabel2" );
    TextLabel2->setText( tr( "to" ) );

    end = new QSpinBox(hbox2, "end" );

    start->setMinValue(1);
    end->setMinValue(1);
    if (sizeof(int)==2)
	 { // 16 bit signed integer
	 start->setMaxValue(0x7fff);
	 end->setMaxValue(0x7fff);
	 }
    else
	 { // 32 bit signed integer
	 start->setMaxValue(0x7fffffff);
	 end->setMaxValue(0x7fffffff);
	 }
  
	QButtonGroup *GroupBox0 = new QButtonGroup(2,QGroupBox::Horizontal,tr( "" ),box2, "GroupBox0" );
	GroupBox0->setLineWidth(0);
	GroupBox0->setFlat(true);

    functions = new QComboBox( FALSE, GroupBox0, "functions" );
	
	PushButton3 = new QPushButton(GroupBox0, "PushButton3" );
    PushButton3->setText( tr( "Add function" ) );
    
    boxColumn = new QComboBox( FALSE, GroupBox0, "boxColumn" );
   
    PushButton4 = new QPushButton(GroupBox0, "PushButton4" );
    PushButton4->setText( tr( "Add column" ) );

	QHBox *hbox6=new QHBox (GroupBox0, "hbox6"); 
	hbox6->setSpacing (5);

	buttonPrev = new QPushButton( hbox6, "buttonPrev" );
	buttonPrev->setText("&<<");

	buttonNext = new QPushButton( hbox6, "buttonNext" );
	buttonNext->setText("&>>");

	addCellButton = new QPushButton(GroupBox0, "addCellButton" );
    addCellButton->setText( tr( "Add cell" ) );

	QHBox *hbox3=new QHBox (this, "hbox3"); 
	hbox3->setSpacing (5);
	
	commandes = new ScriptEdit( env, hbox3, "commandes" );
    commandes->setGeometry( QRect(10, 100, 260, 70) );
	commandes->setFocus();
	
	QVBox *box3=new QVBox (hbox3,"box3"); 
	box3->setSpacing (5);
	
    btnOk = new QPushButton(box3, "btnOk" );
    btnOk->setText( tr( "OK" ) );

	btnApply = new QPushButton(box3, "btnApply" );
    btnApply->setText( tr( "Apply" ) );

    btnCancel = new QPushButton( box3, "btnCancel" );
    btnCancel->setText( tr( "Cancel" ) );
	
	QVBoxLayout* layout = new QVBoxLayout(this,5,5, "hlayout3");
    layout->addWidget(hbox1);
	layout->addWidget(hbox3);

setFunctions();
insertExplain(0);

connect(PushButton3, SIGNAL(clicked()),this, SLOT(insertFunction()));
connect(PushButton4, SIGNAL(clicked()),this, SLOT(insertCol()));
connect(addCellButton, SIGNAL(clicked()),this, SLOT(insertCell()));
connect(btnOk, SIGNAL(clicked()),this, SLOT(accept()));
connect(btnApply, SIGNAL(clicked()),this, SLOT(apply()));
connect(btnCancel, SIGNAL(clicked()),this, SLOT(close()));
connect(functions, SIGNAL(activated(int)),this, SLOT(insertExplain(int)));
connect(buttonPrev, SIGNAL(clicked()), this, SLOT(prevColumn()));
connect(buttonNext, SIGNAL(clicked()), this, SLOT(nextColumn()));
}
Esempio n. 5
0
GLView::GLView( const QGLFormat & format, QWidget * p, const QGLWidget * shareWidget )
	: QGLWidget( format, p, shareWidget )
{
	setFocusPolicy( Qt::ClickFocus );
	//setAttribute( Qt::WA_PaintOnScreen );
	//setAttribute( Qt::WA_NoSystemBackground );
	setAutoFillBackground( false );
	setAcceptDrops( true );
	setContextMenuPolicy( Qt::CustomContextMenu );

	// Manually handle the buffer swap
	// Fixes bug with QGraphicsView and double buffering
	//	Input becomes sluggish and CPU usage doubles when putting GLView
	//	inside a QGraphicsView.
	setAutoBufferSwap( false );

	// Make the context current on this window
	makeCurrent();

	// Create an OpenGL context
	glContext = context()->contextHandle();

	// Obtain a functions object and resolve all entry points
	glFuncs = glContext->functions();

	if ( !glFuncs ) {
		Message::critical( this, tr( "Could not obtain OpenGL functions" ) );
		exit( 1 );
	}

	glFuncs->initializeOpenGLFunctions();

	view = ViewDefault;
	animState = AnimEnabled;
	debugMode = DbgNone;

	Zoom = 1.0;

	doCenter  = false;
	doCompile = false;

	model = nullptr;

	time = 0.0;
	lastTime = QTime::currentTime();

	textures = new TexCache( this );

	scene = new Scene( textures, glContext, glFuncs );
	connect( textures, &TexCache::sigRefresh, this, static_cast<void (GLView::*)()>(&GLView::update) );
	connect( scene, &Scene::sceneUpdated, this, static_cast<void (GLView::*)()>(&GLView::update) );

	timer = new QTimer( this );
	timer->setInterval( 1000 / FPS );
	timer->start();
	connect( timer, &QTimer::timeout, this, &GLView::advanceGears );

	lightVisTimeout = 1500;
	lightVisTimer = new QTimer( this );
	lightVisTimer->setSingleShot( true );
	connect( lightVisTimer, &QTimer::timeout, [this]() { setVisMode( Scene::VisLightPos, false ); update(); } );

	connect( Options::get(), &Options::sigFlush3D, textures, &TexCache::flush );
	connect( Options::get(), &Options::sigChanged, this, static_cast<void (GLView::*)()>(&GLView::update) );
	connect( Options::get(), &Options::materialOverridesChanged, this, &GLView::updateScene );
}
Esempio n. 6
0
 VisorOpenGL::VisorOpenGL(QWidget *parent)
     : QGLWidget(parent) {

     // Definimos el tamaño del volumen de visualización
     Window_width=5;//5;
     Window_height=5;//5;
     Front_plane=10;
     Back_plane=1000;

     // permitimos al componente tener el foco y aceptar eventos
     setFocusPolicy(Qt::StrongFocus);

     //iniciamos las camaras
     Camera camera;

     //camara 1 frente
     this->VRP.x=250;this->VRP.y=200;this->VRP.z=0;
     this->VPN.x=1;this->VPN.y=1;this->VPN.z=0;
     this->VUP.x=0;this->VUP.y=1;this->VUP.z=0;
     camera.set(VRP,VPN,VUP);
     cameras.push_back(camera);

     //camara 2
     this->VRP.x=100;this->VRP.y=75;this->VRP.z=200;
     this->VPN.x=1;this->VPN.y=1;this->VPN.z=3;
     this->VUP.x=0;this->VUP.y=1;this->VUP.z=0;
     camera.set(VRP,VPN,VUP);
     camera.fixedCamera(true);
     cameras.push_back(camera);


     //camara 3 vista pajaro
     this->VRP.x=0;this->VRP.y=300;this->VRP.z=0;
     this->VPN.x=0;this->VPN.y=1;this->VPN.z=0;
     this->VUP.x=1;this->VUP.y=0;this->VUP.z=0;
     camera.set(VRP,VPN,VUP);
     cameras.push_back(camera);


     //camara 4 lateral drcho
     this->VRP.x=0;this->VRP.y=40;this->VRP.z=-200;
     this->VPN.x=0;this->VPN.y=0;this->VPN.z=-1;
     this->VUP.x=0;this->VUP.y=1;this->VUP.z=0;
     camera.set(VRP,VPN,VUP);
     cameras.push_back(camera);

     //camara 5 cam ajustable
     this->VRP.x=0;this->VRP.y=40;this->VRP.z=0;
     this->VPN.x=1;this->VPN.y=1;this->VPN.z=0;
     this->VUP.x=0;this->VUP.y=-1;this->VUP.z=0;
     camera.set(VRP,VPN,VUP);
     cameras.push_back(camera);

     //camara 6 gallery cam
     this->VRP.x=15;this->VRP.y=10;this->VRP.z=0;
     this->VPN.x=1;this->VPN.y=1;this->VPN.z=0;
     this->VUP.x=0;this->VUP.y=1;this->VUP.z=0;
     camera.set(VRP,VPN,VUP);
     cameras.push_back(camera);

     //definimos la camara a visualizar
     camera_actual = 0;
     ncameras = 5 ;

     _fog = false;
}
TextDialog::TextDialog(TextType type, QWidget* parent,  const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
		setName( "TextDialog" );

    setCaption( tr( "QtiPlot - Text options" ) );
    setSizeGripEnabled( true );
	
	text_type = type;
	GroupBox1 = new QButtonGroup(3,QGroupBox::Horizontal, QString::null, this);

	new QLabel(tr( "Color" ), GroupBox1);
	
    colorBox = new ColorButton(GroupBox1);

	buttonOk = new QPushButton( GroupBox1);
    buttonOk->setText( tr( "&OK" ) );
    buttonOk->setAutoDefault( TRUE );
    buttonOk->setDefault( TRUE );

	new QLabel(tr( "Font" ),GroupBox1);
	buttonFont = new QPushButton( GroupBox1, "buttonFont" );
    buttonFont->setText( tr( "&Font" ) );

	buttonApply = new QPushButton( GroupBox1, "buttonApply" );
    buttonApply->setText( tr( "&Apply" ) );
    buttonApply->setDefault( TRUE );
	
	if (text_type)
		{
		new QLabel(tr( "Alignement" ),GroupBox1, "TextLabel1_22",0);
		alignementBox = new QComboBox( FALSE, GroupBox1, "alignementBox" );
		alignementBox->insertItem( tr( "Center" ) );
		alignementBox->insertItem( tr( "Left" ) );
		alignementBox->insertItem( tr( "Right" ) );
		}
	else
		{
		new QLabel(tr( "Frame" ), GroupBox1, "TextLabel1",0 );
		backgroundBox = new QComboBox( FALSE, GroupBox1, "backgroundBox" );
		backgroundBox->insertItem( tr( "None" ) );
		backgroundBox->insertItem( tr( "Rectangle" ) );
		backgroundBox->insertItem( tr( "Shadow" ) );
		}

	buttonCancel = new QPushButton( GroupBox1, "buttonCancel" );
    buttonCancel->setText( tr( "&Cancel" ) );

	if (text_type == TextMarker)
		{
		new QLabel(tr("Background"), GroupBox1, "TextLabel2",0 );
		backgroundBtn = new ColorButton(GroupBox1);

		connect(backgroundBtn, SIGNAL(clicked()), this, SLOT(pickBackgroundColor()));

		buttonDefault = new QPushButton( GroupBox1);
		buttonDefault->setText( tr( "Set &Default" ) );
		connect(buttonDefault, SIGNAL(clicked()), this, SLOT(setDefaultValues()));
		}

	QLabel* rotate=new QLabel(tr( "Rotate (deg.)" ),GroupBox1, "TextLabel1_2",0);
	rotate->hide();
	
    rotateBox = new QComboBox( FALSE, GroupBox1, "rotateBox" );
    rotateBox->insertItem( tr( "0" ) );
    rotateBox->insertItem( tr( "45" ) );
    rotateBox->insertItem( tr( "90" ) );
    rotateBox->insertItem( tr( "135" ) );
    rotateBox->insertItem( tr( "180" ) );
    rotateBox->insertItem( tr( "225" ) );
    rotateBox->insertItem( tr( "270" ) );
    rotateBox->insertItem( tr( "315" ) );
	rotateBox->setEditable (TRUE);
	rotateBox->setCurrentItem(0);
	rotateBox->hide();
	
	GroupBox2= new QButtonGroup(8, QGroupBox::Horizontal, QString::null,this, "GroupBox2" );

	if (text_type == TextMarker)
		{
		buttonCurve = new QPushButton( GroupBox2, "buttonCurve" ); 
		buttonCurve->setPixmap (QPixmap(lineSymbol_xpm));
		connect( buttonCurve, SIGNAL( clicked() ), this, SLOT(addCurve() ) );
		}

    buttonIndice = new QPushButton( GroupBox2, "buttonIndice" ); 
    buttonIndice->setPixmap (QPixmap(index_xpm));

    buttonExp = new QPushButton( GroupBox2, "buttonExp" );
    buttonExp->setPixmap (QPixmap(exp_xpm));

    buttonMinGreek = new QPushButton(QChar(0x3B1), GroupBox2, "buttonMinGreek" ); 
	buttonMinGreek->setMaximumWidth(40);

	buttonMajGreek = new QPushButton(QChar(0x393), GroupBox2, "buttonMajGreek" ); 
	buttonMajGreek->setMaximumWidth(40);

	QFont font = this->font();
	font.setBold(true);

    buttonB = new QPushButton(tr("B"), GroupBox2, "buttonB" ); 
    buttonB->setFont(font);
	buttonB->setMaximumWidth(40);

	font = this->font();
	font.setItalic(true);
    buttonI = new QPushButton(tr("It"), GroupBox2, "buttonI" );
	buttonI->setFont(font);
	buttonI->setMaximumWidth(40);

	font = this->font();
	font.setUnderline(true);

    buttonU = new QPushButton(tr("U"), GroupBox2, "buttonU" );
	buttonU->setFont(font);
	buttonU->setMaximumWidth(40);

    textEditBox = new QTextEdit( this);
	textEditBox->setTextFormat(QTextEdit::PlainText);

	setFocusPolicy(QWidget::StrongFocus);
	setFocusProxy(textEditBox);
	
	QVBoxLayout* vlayout = new QVBoxLayout(this,5,5, "vlayout");
    vlayout->addWidget(GroupBox1);
	vlayout->addWidget(GroupBox2);
	vlayout->addWidget(textEditBox);

    // signals and slots connections
	connect( colorBox, SIGNAL( clicked() ), this, SLOT( pickTextColor() ) );
    connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
	connect( buttonApply, SIGNAL( clicked() ), this, SLOT( apply() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
	connect( buttonFont, SIGNAL( clicked() ), this, SLOT(customFont() ) );
	connect( buttonExp, SIGNAL( clicked() ), this, SLOT(addExp() ) );
	connect( buttonIndice, SIGNAL( clicked() ), this, SLOT(addIndex() ) );
	connect( buttonU, SIGNAL( clicked() ), this, SLOT(addUnderline() ) );
	connect( buttonI, SIGNAL( clicked() ), this, SLOT(addItalic() ) );
	connect( buttonB, SIGNAL( clicked() ), this, SLOT(addBold() ) );
	connect( buttonMinGreek, SIGNAL(clicked()), this, SLOT(showMinGreek()));
	connect( buttonMajGreek, SIGNAL(clicked()), this, SLOT(showMajGreek()));
}
AnimationForm::AnimationForm(CEditData *pImageData, CSettings *pSetting, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::AnimationForm)
{
	m_pEditData		= pImageData ;
	m_pSetting		= pSetting ;
	m_bDontSetData	= false ;
	m_frameStart	= pSetting->getFrameStart() ;
	m_frameEnd		= pSetting->getFrameEnd() ;

	m_oldWinSize = QSize(-1, -1) ;

	ui->setupUi(this);

	m_pEditData->setTreeView(ui->treeView) ;

	ui->label_frame->setEditData(m_pEditData) ;
	ui->label_frame->setHorizontalBar(ui->horizontalScrollBar_frame) ;
	m_pDataMarker = ui->label_frame ;

	setFocusPolicy(Qt::StrongFocus);

	m_pGlWidget = new AnimeGLWidget(pImageData, pSetting, this) ;
	ui->scrollArea_anime->setWidget(m_pGlWidget);
	m_pGlWidget->resize(m_pSetting->getAnmWindowW(), m_pSetting->getAnmWindowH());
	m_pGlWidget->setDrawArea(m_pSetting->getAnmWindowW(), m_pSetting->getAnmWindowH());
	m_pGlWidget->show();

	ui->radioButton_pos->setChecked(true);
	ui->checkBox_grid->setChecked(true);
	ui->spinBox_fps->setValue(60) ;
	ui->checkBox_frame->setChecked(pSetting->getDrawFrame());
	ui->checkBox_center->setChecked(pSetting->getDrawCenter());
	ui->spinBox_frame_start->setValue(m_frameStart) ;
	ui->spinBox_frame_end->setValue(m_frameEnd) ;
	ui->label_frame->slot_setFrameStart(m_frameStart) ;
	ui->label_frame->slot_setFrameEnd(m_frameEnd) ;

	for ( int i = 0 ; i < m_pEditData->getImageDataListSize() ; i ++ ) {
		CEditData::ImageData *p = m_pEditData->getImageData(i) ;
		if ( !p ) { continue ; }
		ui->comboBox_image_no->addItem(tr("%1").arg(p->nNo));
	}

	m_pSplitter = new AnimationWindowSplitter(this) ;
	m_pSplitter->addWidget(ui->treeView) ;
	m_pSplitter->addWidget(ui->scrollArea_anime) ;
	m_pSplitter->setGeometry(ui->treeView->pos().x(),
						   ui->treeView->pos().y(),
						   ui->scrollArea_anime->width()+ui->scrollArea_anime->pos().x()-ui->treeView->pos().x(),
						   ui->treeView->height());

	{
		CObjectModel *pModel = m_pEditData->getObjectModel() ;

		ui->treeView->setModel(pModel);
		ui->treeView->header()->setHidden(true);
		ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);

		ui->treeView->setDragEnabled(true) ;
		ui->treeView->setAcceptDrops(true) ;
		ui->treeView->setDropIndicatorShown(true) ;
		ui->treeView->setDragDropMode(QAbstractItemView::DragDrop) ;
		ui->treeView->setFocusPolicy(Qt::NoFocus);

		ObjectItem *root = pModel->getItemFromIndex(QModelIndex()) ;
		if ( !root->childCount() ) {
			addNewObject(trUtf8("New Object"));
		}
		else {
			if ( root->child(0) ) {
				QModelIndex index = pModel->index(0) ;
				ui->treeView->setCurrentIndex(index);
			}
		}
	}

	m_pActTreeViewAdd		= new QAction(QString("Add Object"), this);
	m_pActTreeViewCopy		= new QAction(QString("Copy Object"), this) ;
	m_pActTreeViewDel		= new QAction(QString("Delete"), this);
	m_pActTreeViewLayerDisp = new QAction(QString("Disp"), this) ;
	m_pActTreeViewLayerLock = new QAction(QString("Lock"), this) ;

	m_pTimer = new QTimer(this) ;
	m_pTimer->setInterval((int)(100.0f/6.0f));

	connect(ui->label_frame, SIGNAL(sig_changeValue(int)), this, SLOT(slot_frameChanged(int))) ;
	connect(ui->radioButton_pos, SIGNAL(clicked(bool)), this, SLOT(slot_clickedRadioPos(bool))) ;
	connect(ui->radioButton_rot, SIGNAL(clicked(bool)), this, SLOT(slot_clickedRadioRot(bool))) ;
	connect(ui->radioButton_center, SIGNAL(clicked(bool)), this, SLOT(slot_clickedRadioCenter(bool))) ;
	connect(ui->radioButton_scale, SIGNAL(clicked(bool)), this, SLOT(slot_clickedRadioScale(bool))) ;
	connect(ui->radioButton_path, SIGNAL(clicked(bool)), this, SLOT(slot_clickedRadioPath(bool))) ;

	connect(ui->treeView, SIGNAL(customContextMenuRequested(QPoint)),	this, SLOT(slot_treeViewMenuReq(QPoint))) ;
	connect(ui->treeView, SIGNAL(clicked(QModelIndex)),					this, SLOT(slot_changeSelectObject(QModelIndex))) ;

	connect(m_pGlWidget, SIGNAL(sig_dropedImage(QRectF, QPoint, int)), this, SLOT(slot_dropedImage(QRectF, QPoint, int))) ;
	connect(m_pGlWidget, SIGNAL(sig_selectLayerChanged(QModelIndex)), this, SLOT(slot_selectLayerChanged(QModelIndex))) ;
	connect(m_pGlWidget, SIGNAL(sig_dragedImage(FrameData)), this, SLOT(slot_setUI(FrameData))) ;
	connect(m_pGlWidget, SIGNAL(sig_deleteFrameData()), this, SLOT(slot_deleteFrameData())) ;
	connect(m_pGlWidget, SIGNAL(sig_selectPrevLayer(QModelIndex, int, FrameData)), this, SLOT(slot_addNewFrameData(QModelIndex, int, FrameData))) ;
	connect(m_pGlWidget, SIGNAL(sig_frameDataMoveEnd(FrameData)), this, SLOT(slot_frameDataMoveEnd(FrameData))) ;
	connect(m_pGlWidget, SIGNAL(sig_dragedImage(FrameData)), this, SLOT(slot_portDragedImage(FrameData))) ;

	connect(ui->doubleSpinBox_pos_x,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changePosX(double))) ;
	connect(ui->doubleSpinBox_pos_y,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changePosY(double))) ;
	connect(ui->doubleSpinBox_pos_z,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changePosZ(double))) ;
	connect(ui->doubleSpinBox_rot_x,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeRotX(double))) ;
	connect(ui->doubleSpinBox_rot_y,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeRotY(double))) ;
	connect(ui->doubleSpinBox_rot_z,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeRotZ(double))) ;
	connect(ui->doubleSpinBox_scale_x,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeScaleX(double))) ;
	connect(ui->doubleSpinBox_scale_y,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeScaleY(double))) ;
	connect(ui->doubleSpinBox_uv_left,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeUvLeft(double))) ;
	connect(ui->doubleSpinBox_uv_right,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeUvRight(double))) ;
	connect(ui->doubleSpinBox_uv_top,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeUvTop(double))) ;
	connect(ui->doubleSpinBox_uv_bottom,SIGNAL(valueChanged(double)),	this, SLOT(slot_changeUvBottom(double))) ;
	connect(ui->doubleSpinBox_center_x,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeCenterX(double))) ;
	connect(ui->doubleSpinBox_center_y,	SIGNAL(valueChanged(double)),	this, SLOT(slot_changeCenterY(double))) ;
	connect(ui->spinBox_frame_start,	SIGNAL(valueChanged(int)),		this, SLOT(slot_changeFrameStart(int))) ;
	connect(ui->spinBox_frame_end,		SIGNAL(valueChanged(int)),		this, SLOT(slot_changeFrameEnd(int))) ;

	connect(m_pActTreeViewAdd,			SIGNAL(triggered()),			this, SLOT(slot_createNewObject())) ;
	connect(m_pActTreeViewCopy,			SIGNAL(triggered()),			this, SLOT(slot_copyObject())) ;
	connect(m_pActTreeViewDel,			SIGNAL(triggered()),			this, SLOT(slot_deleteObject())) ;
	connect(m_pActTreeViewLayerDisp,	SIGNAL(triggered()),			this, SLOT(slot_changeLayerDisp())) ;
	connect(m_pActTreeViewLayerLock,	SIGNAL(triggered()),			this, SLOT(slot_changeLayerLock())) ;

	connect(ui->pushButton_play,		SIGNAL(clicked()),				this, SLOT(slot_playAnimation())) ;
	connect(ui->pushButton_stop,		SIGNAL(clicked()),				this, SLOT(slot_stopAnimation())) ;
	connect(ui->pushButton_backward,	SIGNAL(clicked()),				this, SLOT(slot_backwardFrameData())) ;
	connect(ui->pushButton_forward,		SIGNAL(clicked()),				this, SLOT(slot_forwardFrameData())) ;
	connect(ui->checkBox_grid,			SIGNAL(clicked(bool)),			m_pGlWidget, SLOT(slot_setDrawGrid(bool))) ;
	connect(ui->checkBox_uv_anime,		SIGNAL(clicked(bool)),			this, SLOT(slot_changeUVAnime(bool))) ;
	connect(ui->spinBox_fps,			SIGNAL(valueChanged(int)),		this, SLOT(slot_changeAnimeSpeed(int))) ;
	connect(ui->comboBox_image_no,		SIGNAL(activated(QString)),		this, SLOT(slot_changeImageIndex(QString))) ;
	connect(m_pTimer,					SIGNAL(timeout()),				this, SLOT(slot_timerEvent())) ;
	connect(ui->spinBox_loop,			SIGNAL(valueChanged(int)),		this, SLOT(slot_changeLoop(int))) ;
	connect(ui->spinBox_r,				SIGNAL(valueChanged(int)),		this, SLOT(slot_changeColorR(int))) ;
	connect(ui->spinBox_g,				SIGNAL(valueChanged(int)),		this, SLOT(slot_changeColorG(int))) ;
	connect(ui->spinBox_b,				SIGNAL(valueChanged(int)),		this, SLOT(slot_changeColorB(int))) ;
	connect(ui->spinBox_a,				SIGNAL(valueChanged(int)),		this, SLOT(slot_changeColorA(int))) ;
	connect(ui->checkBox_frame,			SIGNAL(clicked(bool)),			this, SLOT(slot_changeDrawFrame(bool))) ;
	connect(ui->checkBox_center,		SIGNAL(clicked(bool)),			this, SLOT(slot_changeDrawCenter(bool))) ;
	connect(ui->checkBox_linear_filter,	SIGNAL(clicked(bool)),			this, SLOT(slot_changeLinearFilter(bool))) ;
	connect(ui->toolButton_picker,		SIGNAL(clicked()),				this, SLOT(slot_clickPicker())) ;
	connect(m_pSplitter,				SIGNAL(splitterMoved(int,int)), this, SLOT(slot_splitterMoved(int, int))) ;
	connect(m_pEditData->getObjectModel(), SIGNAL(sig_copyIndex(int,ObjectItem*,QModelIndex,Qt::DropAction)), this, SLOT(slot_copyIndex(int, ObjectItem*, QModelIndex,Qt::DropAction))) ;

	connect(ui->pushButton_del_path,	SIGNAL(clicked()),				this, SLOT(slot_delPath())) ;
	connect(this, SIGNAL(sig_changeFrameStart(int)),	ui->label_frame, SLOT(slot_setFrameStart(int))) ;
	connect(this, SIGNAL(sig_changeFrameEnd(int)),		ui->label_frame, SLOT(slot_setFrameEnd(int))) ;

	connect(ui->label_frame, SIGNAL(sig_changeValue(int)), ui->spinBox_nowSequence, SLOT(setValue(int))) ;
	connect(ui->spinBox_nowSequence, SIGNAL(valueChanged(int)), this, SLOT(slot_frameChanged(int))) ;
	connect(ui->horizontalScrollBar_frame, SIGNAL(valueChanged(int)), ui->label_frame, SLOT(slot_moveScrollBar(int))) ;
	connect(ui->label_frame, SIGNAL(sig_moveFrameData(int,int)), this, SLOT(slot_moveFrameData(int,int))) ;

	connect(m_pGlWidget, SIGNAL(sig_scrollWindow(QPoint)), this, SLOT(slot_scrollWindow(QPoint))) ;
}
Esempio n. 9
0
void DateFormWidget::setupFocusPolicy()
{
    m_dateTimeEdit->setFocusPolicy(Qt::ClickFocus);
    setFocusProxy(m_dateTimeEdit);
    setFocusPolicy(Qt::StrongFocus);
}
Esempio n. 10
0
Plot::Plot(int width, int height, QWidget *parent, const char *)
: QwtPlot(parent)
{
	setAutoReplot (false);

	marker_key = 0;
	curve_key = 0;

	minTickLength = 5;
	majTickLength = 9;

	setGeometry(QRect(0, 0, width, height));
	setAxisTitle(QwtPlot::yLeft, tr("Y Axis Title"));
	setAxisTitle(QwtPlot::xBottom, tr("X Axis Title"));
	//due to the plot layout updates, we must always have a non empty title
	setAxisTitle(QwtPlot::yRight, tr(" "));
	setAxisTitle(QwtPlot::xTop, tr(" "));

	// grid
	d_grid = new Grid();
	d_grid->attach(this);

	//custom scale
	for (int i= 0; i<QwtPlot::axisCnt; i++) {
		QwtScaleWidget *scale = (QwtScaleWidget *) axisWidget(i);
		if (scale) {
			scale->setMargin(0);

			//the axis title color must be initialized...
			QwtText title = scale->title();
			title.setColor(Qt::black);
			scale->setTitle(title);

            //...same for axis color
            QPalette pal = scale->palette();
            pal.setColor(QPalette::Foreground, QColor(Qt::black));
            scale->setPalette(pal);

			ScaleDraw *sd = new ScaleDraw(this);
			sd->setTickLength(QwtScaleDiv::MinorTick, minTickLength);
			sd->setTickLength(QwtScaleDiv::MediumTick, minTickLength);
			sd->setTickLength(QwtScaleDiv::MajorTick, majTickLength);

			setAxisScaleDraw (i, sd);
			setAxisScaleEngine (i, new ScaleEngine());
		}
	}

	QwtPlotLayout *pLayout = plotLayout();
	pLayout->setCanvasMargin(0);
	pLayout->setAlignCanvasToScales (true);

	QwtPlotCanvas* plCanvas = canvas();
	plCanvas->setFocusPolicy(Qt::StrongFocus);
	plCanvas->setFocusIndicator(QwtPlotCanvas::ItemFocusIndicator);
	//plCanvas->setFocus();
	plCanvas->setFrameShadow(QwtPlot::Plain);
	plCanvas->setCursor(Qt::arrowCursor);
	plCanvas->setLineWidth(0);
	plCanvas->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
	plCanvas->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);

    QColor background = QColor(Qt::white);
    background.setAlpha(255);

	QPalette palette;
    palette.setColor(QPalette::Window, background);
    setPalette(palette);

	setCanvasBackground (background);
	setFocusPolicy(Qt::StrongFocus);
	//setFocusProxy(plCanvas);
	setFrameShape(QFrame::Box);
	setLineWidth(0);
}
Esempio n. 11
0
FxWidget::FxWidget(QWidget *parent, Qt::WindowFlags flag) :
    QWidget(parent, flag)
{
    FX_FUNCTION
    bgScaleLeft = 65;
    bgScaleRight = 130;
    bgScaleBottom = 58;
    bgScaleTop = 135;

    _autoHide = false;
    _enableautoHide = false;
    _isSetSystemTitleBar = false;
    // for "editable label"
    setFocusPolicy(Qt::ClickFocus);

    //resizer
    QWidgetResizeHandler *qwrh = new QWidgetResizeHandler(this);
    Q_UNUSED(qwrh);
    /*
     _______________________________________________________
     | _____________________________________________ | ___ |
     | |              titleBar                     | | |s| |
     | | icon |   title      | min | max | close | | | |i| |
     | |___________________________________________| | |d| |
     | ____________________________________________  | |e| |
     | |                                           | | |B| |
     | |	                                          | | |a| |
     | |              contentWidget                | | |r| |
     | |	                                          | | |R| |
     | |	                                          | | |L| |
     | |___________________________________________| | |_| |
     |_______________________________________________|_____|
     |  ___________________________________________  |     |
     | |______________sideBarTB___________________|  |     |
     |_______________________________________________|_____|

     */

    _mainLayout = new QGridLayout(this);
    contentWidget = new QWidget(this);

    titleBar = new FxWidgetTitleBar(this);
    connect(this, SIGNAL(triggleMaximizeAndNormal()), titleBar->btnMaximize,
            SLOT(click()));
    _mainLayout->addWidget(titleBar, 0, 0);
    _mainLayout->addWidget(contentWidget, 1, 0);

    sideBarRL = new QLabel(this);
    sideBarRL->setSizePolicy(QSizePolicy(QSizePolicy::Ignored,
            QSizePolicy::Expanding));
    sideBarRL->setMaximumWidth(3); //@To FIX  magic number
    sideBarTB = new QLabel(this);
    sideBarTB->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
            QSizePolicy::Ignored));
    //sideBarRL->setMaximumHeight(3);//@To FIX  magic number
    sideBarTB->setObjectName("sideBarTB");
    sideBarRL->setObjectName("sideBarRL");
    _mainLayout->addWidget(sideBarRL, 0, 0, 2, 1);
    _mainLayout->addWidget(sideBarTB, 2, 0);
    sideBarRL->hide();
    sideBarTB->hide();

    _mainLayout->setSpacing(0);
    _mainLayout->setMargin(0);
    setContentsMargins(3, 0, 3, 3);
    QWidget::setLayout(_mainLayout);
    orientSize = size();
    updateWindowPositionType();
}
Esempio n. 12
0
ZObjsManagerWidget::ZObjsManagerWidget(ZStackDoc *doc, QWidget *parent) :
  QWidget(parent), m_doc(doc)
{
  setFocusPolicy(Qt::StrongFocus);
  createWidget();
}
Esempio n. 13
0
MainWindow::MainWindow(QApplication* a_) {
    a=a_;
    score=0, lives=5;
    interval=0;  
    paused=false;  
    
    //Initialize unused pointers
    timer = NULL;
    player = NULL;
    pauseButton = NULL;
    resignButton = NULL;
    quitButton = NULL;
    
    //We need a scene and a view to do graphics in QT
    scene = new QGraphicsScene();
    setScene(scene);
    
    //This sets the size of the window and gives it a title.
    setFixedSize( 1005, 505 );
    setWindowTitle( "Caterpillars");
    setFocusPolicy(Qt::StrongFocus);
    setFocus();
    
    mainMap = new QPixmap("images/main.png");
    canvas = new Canvas(0, 0, 1000, 500, 20, 0, 0, 0);
    canvas->setPixmap(*mainMap);
    scene->addItem(canvas);
    
    titleText = new QGraphicsSimpleTextItem("THE VERY HUNGRY\n     CATERPILLAR");
    titleText->setPos(220,100);
    titleText->setFont(QFont("Times New Roman", 40, QFont::Bold));
    titleText->setPen(QPen(Qt::white, 1, Qt::SolidLine));
    scene->addItem(titleText);
    
    subtitleText = new QGraphicsSimpleTextItem("A Qt game by Eric Pakravan, based on the story and artwork by Eric Carle");
    subtitleText->setPos(160,252);
    subtitleText->setFont(QFont("Ubuntu", 14, QFont::Bold));
    scene->addItem(subtitleText);
    
    scoreCaptionText = new QGraphicsSimpleTextItem("Score: ");
    scoreCaptionText->setPos(500,2);
    scoreCaptionText->setFont(QFont("Ubuntu", 15, QFont::Bold));
    scoreCaptionText->setPen(QPen(Qt::red, 1, Qt::SolidLine));
    
    livesCaptionText = new QGraphicsSimpleTextItem("Lives: ");
    livesCaptionText->setPos(750,2);
    livesCaptionText->setFont(QFont("Ubuntu", 15, QFont::Bold));
    livesCaptionText->setPen(QPen(Qt::red, 1, Qt::SolidLine));
    
    scoreText = new QGraphicsSimpleTextItem(QString::number(score));
    scoreText->setPos(565,2);
    scoreText->setFont(QFont("Ubuntu", 15, QFont::Bold));
    scoreText->setPen(QPen(Qt::red, 1, Qt::SolidLine));
    
    livesText = new QGraphicsSimpleTextItem(QString::number(lives));
    livesText->setPos(810,2);
    livesText->setFont(QFont("Ubuntu", 15, QFont::Bold));
    livesText->setPen(QPen(Qt::red, 1, Qt::SolidLine));
    
    startButton = new QPushButton("Start!", this);
    startButton->setMinimumWidth(120);
    startButton->move(440, 280);
    startButton->setFont(QFont("Ubuntu", 20, QFont::Bold));
    connect(startButton, SIGNAL(clicked()), this, SLOT(StartGame()));
    startButton->show();
    
    backgroundMap = new QPixmap("images/background.png");
    caterpillarMap = new QPixmap("images/caterpillar.png");
  
    leafMap = new QPixmap("images/leaf.png");
    
    strawberryMap = new QPixmap("images/strawberry.png");
    orangeMap = new QPixmap("images/orange.png");
    plumMap = new QPixmap("images/plum.png");
    appleMap = new QPixmap("images/apple.png");
    pearMap = new QPixmap("images/pear.png");
    
    sunMap = new QPixmap("images/sun.png");
    
    ladybugMap = new QPixmap("images/ladybug.png");
    spiderMap = new QPixmap("images/spider.png");
    beeMap = new QPixmap("images/bee.png");

    cakeMap = new QPixmap("images/cake.png");
    pieMap = new QPixmap("images/pie.png");
    icecreamMap = new QPixmap("images/icecream.png");
    cupcakeMap = new QPixmap("images/cupcake.png");
    
}
Esempio n. 14
0
/* 
 *  Constructs a OptionDlg which is a child of 'parent', with the 
 *  name 'name' and widget flags set to 'f' 
 */
OptionDlg::OptionDlg( QWidget* parent,  const char* name, WFlags fl )
    : OptionForm( parent, name, fl )
{
  connect(m_btnOK, SIGNAL(clicked()), this, SLOT(updateSettings()));
  connect(m_btnCancel, SIGNAL(clicked()), this, SIGNAL(endDialog()));

  // font option ( check OptionDlg::updateExFont method );
  m_wFonts->insertItem(tr("Default Font"), 0);
  //m_wFonts->insertItem("Progress Bar", 1);

  // color option ( check OptionDlg::updateExColor method )
  m_wColors->insertItem(tr("Background"), 0);
  m_wColors->insertItem(tr("Normal Text"), 1);
  m_wColors->insertItem(tr("HighLight Text 1"), 2);
  m_wColors->insertItem(tr("HighLight Text 2"), 3);
  m_wColors->insertItem(tr("HighLight Text 3"), 4);
  m_wColors->insertItem(tr("HighLight Text 4"), 5);
  m_wColors->insertItem(tr("HighLight Text 5"), 6);
  m_wColors->insertItem(tr("HighLight Text 6"), 7);
  m_wColors->insertItem(tr("HighLight Text 7"), 8);
  m_wColors->insertItem(tr("Progress Bar FG"), 9);
  m_wColors->insertItem(tr("Progress Bar BG"), 10);
  m_wColors->insertItem(tr("Progress Bar Text"), 11);

  m_wFontName->insertStringList(QFontDatabase().families());

  connect(m_wFontName, SIGNAL(activated(int)), this, SLOT(updateFontFace()));
  connect(m_wFontSize, SIGNAL(valueChanged(int)), this, SLOT(updateFontFace()));
  connect(m_wFonts, SIGNAL(activated(int)), this, SLOT(changeFont()));
  connect(m_wBold, SIGNAL(toggled(bool)), this, SLOT(updateFontFace()));
  connect(m_wFakeBold, SIGNAL(toggled(bool)), this, SLOT(updateFontFace()));

  connect(m_wColors, SIGNAL(activated(int)), this, SLOT(changeColor()));
  connect(m_wColorEdit, SIGNAL(returnPressed()), this, SLOT(updateColorFace()));
  connect(m_wRed, SIGNAL(valueChanged(int)), this, SLOT(rgbChange()));
  connect(m_wGreen, SIGNAL(valueChanged(int)), this, SLOT(rgbChange()));
  connect(m_wBlue, SIGNAL(valueChanged(int)), this, SLOT(rgbChange()));

  connect(m_wMargin, SIGNAL(valueChanged(int)), this, SLOT(updateMargin(int)));
  connect(m_wLineMargin, SIGNAL(valueChanged(int)),
                                      this, SLOT(updateLineMargin(int)));
  connect(m_wRotation, SIGNAL(valueChanged(int)),
                                      this, SLOT(updateRotation(int)));
  connect(m_wShowBar, SIGNAL(toggled(bool)),
                                      this, SLOT(updateBar()));
  connect(m_wBarHeight, SIGNAL(valueChanged(int)),
                                      this, SLOT(updateBar()));

  connect(m_wScrollHeight, SIGNAL(valueChanged(int)),
                                      this, SLOT(updateScrollHeight(int)));
  connect(m_wScrollDelay, SIGNAL(valueChanged(int)),
                                      this, SLOT(updateScrollDelay(int)));

  connect(m_wScalingMethod,SIGNAL(activated(int)),
      this, SLOT(updateScaleMethod(int)));
  connect(m_wScaleFactor,SIGNAL(valueChanged(int)),
      this, SLOT(updateScaleFactor(int)));
  connect(m_wScaleUp,SIGNAL(stateChanged(int)),
      this, SLOT(updateScaleUp(int)));
  connect(m_wHSlices,SIGNAL(valueChanged(int)),
      this, SLOT(updateSlicingCount()));
  connect(m_wVSlices,SIGNAL(valueChanged(int)),
      this, SLOT(updateSlicingCount()));

  connect(m_wScrollMethod,SIGNAL(activated(int)),
      this, SLOT(updateScrollPolicy(int)));
  connect(m_wPageMethod, SIGNAL(activated(int)),
      this, SLOT(updatePagingPolicy(int)));

  setFocusPolicy(QWidget::StrongFocus);

  m_cfg = NULL;
}
Esempio n. 15
0
 FlexButton(QWidget* parent, Flex::Button button) : QToolButton(parent), _button(button)
 {
     setFixedSize(16, 16); setFocusPolicy(Qt::NoFocus);
 }
Esempio n. 16
0
KNMusicAlbumView::KNMusicAlbumView(QWidget *parent) :
    QAbstractItemView(parent),
    m_shadowSource(QPixmap("://public/shadow.png")),
    m_albumArtShadow(QPixmap()),
    m_albumBase(QPixmap(":/plugin/music/public/base.png")),
    m_scaledAlbumBase(QPixmap()),
    m_noAlbumArt(knMusicGlobal->noAlbumArt()),
    m_scaledNoAlbumArt(QPixmap()),
    m_nullIndex(QModelIndex()),
    m_selectedIndex(m_nullIndex),
    m_mouseDownIndex(m_nullIndex),
    m_scrollAnime(new QTimeLine(200, this)),
    m_proxyModel(nullptr),
    m_model(nullptr),
    m_albumDetail(nullptr),
    m_itemWidth(135),
    m_itemMinimalSpacing(30),
    m_minimalWidth(m_itemMinimalSpacing+m_itemWidth),
    m_lineCount(0),
    m_textSpacing(5),
    m_itemHeight(154),
    m_spacing(30),
    m_itemSpacingHeight(m_spacing+m_itemHeight),
    m_itemSpacingWidth(m_spacing+m_itemWidth),
    m_maxColumnCount(0)
{
    setObjectName("MusicAlbumView");
    //Set properties.
    setFocusPolicy(Qt::WheelFocus);
    //Set default scrollbar properties.
    verticalScrollBar()->setRange(0, 0);

    //Set the palette.
    knTheme->registerWidget(this);

    //Configure the timeline.
    m_scrollAnime->setUpdateInterval(10);
    m_scrollAnime->setEasingCurve(QEasingCurve::OutCubic);
    connect(m_scrollAnime, &QTimeLine::frameChanged,
            verticalScrollBar(), &QScrollBar::setValue);

    //Link the scrolling event.
    connect(verticalScrollBar(), &QScrollBar::valueChanged,
            this, &KNMusicAlbumView::onActionScrolling);

    //The icon size should be the item width.
    //Update the painting parameters.
    updateUIElements();
    //Generate the album art shadow pixmap.
    int shadowSize=m_itemWidth+(m_shadowIncrease<<1);
    //Update album art shadow.
    m_albumArtShadow=generateShadow(shadowSize, shadowSize);
    //Update the album base.
    m_scaledAlbumBase=m_albumBase.scaled(m_itemWidth,
                                         m_itemWidth,
                                         Qt::IgnoreAspectRatio,
                                         Qt::SmoothTransformation);
    //Update the no album art.
    m_scaledNoAlbumArt=m_noAlbumArt.scaled(m_itemWidth,
                                           m_itemWidth,
                                           Qt::IgnoreAspectRatio,
                                           Qt::SmoothTransformation);
    //The height of the item should be a item icon size and two text lines.
    m_itemHeight=m_itemWidth+(fontMetrics().height()<<1);

    //Link the search.
    connect(knMusicGlobal->search(), &KNMusicSearchBase::requireSearch,
            this, &KNMusicAlbumView::onActionSearch);
    //Set the search shortcut.
    QAction *searchAction=new QAction(this);
    searchAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_F));
    searchAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    connect(searchAction, &QAction::triggered,
            [=]
            {
                //Check whether the search plugin is loaded.
                if(knMusicGlobal->search())
                {
                    knMusicGlobal->search()->onActionSearchShortcut(this);
                }
            });
    addAction(searchAction);

    //Link the locale manager.
    knI18n->link(this, &KNMusicAlbumView::retranslate);
    retranslate();
}
Esempio n. 17
0
		CustomProxy(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0) : QGraphicsProxyWidget(parent, wFlags)
		{
			setFocusPolicy(Qt::StrongFocus);
		}
Esempio n. 18
0
ColorIndicator::ColorIndicator(QWidget *parent)
    :QWidget(parent), m_color(Qt::white){
    setAttribute(Qt::WA_StaticContents);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    setFocusPolicy(Qt::NoFocus);
}
Esempio n. 19
0
MediaWidget::MediaWidget(KMenu *menu_, KToolBar *toolBar, KActionCollection *collection,
	QWidget *parent) : QWidget(parent), menu(menu_), displayMode(NormalMode),
	automaticResize(ResizeOff), blockBackendUpdates(false), muted(false),
	screenSaverSuspended(false), showElapsedTime(true)
{
	dummySource.reset(new MediaSource());
	source = dummySource.data();

	QBoxLayout *layout = new QVBoxLayout(this);
	layout->setMargin(0);

	QPalette palette = QWidget::palette();
	palette.setColor(backgroundRole(), Qt::black);
	setPalette(palette);
	setAutoFillBackground(true);

	setAcceptDrops(true);
	setFocusPolicy(Qt::StrongFocus);

	backend = VlcMediaWidget::createVlcMediaWidget(this);

	if (backend == NULL) {
		backend = new DummyMediaWidget(this);
	}

	backend->connectToMediaWidget(this);
	layout->addWidget(backend);
	osdWidget = new OsdWidget(this);

	actionPrevious = new KAction(KIcon(QLatin1String("media-skip-backward")), i18n("Previous"), this);
	actionPrevious->setShortcut(KShortcut(Qt::Key_PageUp, Qt::Key_MediaPrevious));
	connect(actionPrevious, SIGNAL(triggered()), this, SLOT(previous()));
	toolBar->addAction(collection->addAction(QLatin1String("controls_previous"), actionPrevious));
	menu->addAction(actionPrevious);

	actionPlayPause = new KAction(this);
	actionPlayPause->setShortcut(KShortcut(Qt::Key_Space, Qt::Key_MediaPlay));
	textPlay = i18n("Play");
	textPause = i18n("Pause");
	iconPlay = KIcon(QLatin1String("media-playback-start"));
	iconPause = KIcon(QLatin1String("media-playback-pause"));
	connect(actionPlayPause, SIGNAL(triggered(bool)), this, SLOT(pausedChanged(bool)));
	toolBar->addAction(collection->addAction(QLatin1String("controls_play_pause"), actionPlayPause));
	menu->addAction(actionPlayPause);

	actionStop = new KAction(KIcon(QLatin1String("media-playback-stop")), i18n("Stop"), this);
	actionStop->setShortcut(KShortcut(Qt::Key_Backspace, Qt::Key_MediaStop));
	connect(actionStop, SIGNAL(triggered()), this, SLOT(stop()));
	toolBar->addAction(collection->addAction(QLatin1String("controls_stop"), actionStop));
	menu->addAction(actionStop);

	actionNext = new KAction(KIcon(QLatin1String("media-skip-forward")), i18n("Next"), this);
	actionNext->setShortcut(KShortcut(Qt::Key_PageDown, Qt::Key_MediaNext));
	connect(actionNext, SIGNAL(triggered()), this, SLOT(next()));
	toolBar->addAction(collection->addAction(QLatin1String("controls_next"), actionNext));
	menu->addAction(actionNext);
	menu->addSeparator();

    fullScreenAction = new KAction(KIcon(QLatin1String("view-fullscreen")),
		i18nc("'Playback' menu", "Full Screen Mode"), this);
	fullScreenAction->setShortcut(Qt::Key_F);
	connect(fullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
	menu->addAction(collection->addAction(QLatin1String("view_fullscreen"), fullScreenAction));

	minimalModeAction = new KAction(KIcon(QLatin1String("view-fullscreen")),
		i18nc("'Playback' menu", "Minimal Mode"), this);
	minimalModeAction->setShortcut(Qt::Key_Period);
	connect(minimalModeAction, SIGNAL(triggered()), this, SLOT(toggleMinimalMode()));
	menu->addAction(collection->addAction(QLatin1String("view_minimal_mode"), minimalModeAction));

	audioStreamBox = new KComboBox(toolBar);
	connect(audioStreamBox, SIGNAL(currentIndexChanged(int)),
		this, SLOT(currentAudioStreamChanged(int)));
	toolBar->addWidget(audioStreamBox);

	audioStreamModel = new QStringListModel(toolBar);
	audioStreamBox->setModel(audioStreamModel);

	subtitleBox = new KComboBox(toolBar);
	textSubtitlesOff = i18nc("subtitle selection entry", "off");
	connect(subtitleBox, SIGNAL(currentIndexChanged(int)),
		this, SLOT(currentSubtitleChanged(int)));
	toolBar->addWidget(subtitleBox);

	subtitleModel = new QStringListModel(toolBar);
	subtitleBox->setModel(subtitleModel);

	KMenu *audioMenu = new KMenu(i18nc("'Playback' menu", "Audio"), this);

	KAction *action = new KAction(KIcon(QLatin1String("audio-volume-high")),
		i18nc("'Audio' menu", "Increase Volume"), this);
	action->setShortcut(KShortcut(Qt::Key_Plus, Qt::Key_VolumeUp));
	connect(action, SIGNAL(triggered()), this, SLOT(increaseVolume()));
	audioMenu->addAction(collection->addAction(QLatin1String("controls_increase_volume"), action));

	action = new KAction(KIcon(QLatin1String("audio-volume-low")),
		i18nc("'Audio' menu", "Decrease Volume"), this);
	action->setShortcut(KShortcut(Qt::Key_Minus, Qt::Key_VolumeDown));
	connect(action, SIGNAL(triggered()), this, SLOT(decreaseVolume()));
	audioMenu->addAction(collection->addAction(QLatin1String("controls_decrease_volume"), action));

	muteAction = new KAction(i18nc("'Audio' menu", "Mute Volume"), this);
	mutedIcon = KIcon(QLatin1String("audio-volume-muted"));
	unmutedIcon = KIcon(QLatin1String("audio-volume-medium"));
	muteAction->setIcon(unmutedIcon);
	muteAction->setShortcut(KShortcut(Qt::Key_M, Qt::Key_VolumeMute));
	connect(muteAction, SIGNAL(triggered()), this, SLOT(mutedChanged()));
	toolBar->addAction(collection->addAction(QLatin1String("controls_mute_volume"), muteAction));
	audioMenu->addAction(muteAction);
	menu->addMenu(audioMenu);

	KMenu *videoMenu = new KMenu(i18nc("'Playback' menu", "Video"), this);
	menu->addMenu(videoMenu);
	menu->addSeparator();

	deinterlaceAction = new KAction(KIcon(QLatin1String("format-justify-center")),
		i18nc("'Video' menu", "Deinterlace"), this);
	deinterlaceAction->setCheckable(true);
	deinterlaceAction->setChecked(
		KGlobal::config()->group("MediaObject").readEntry("Deinterlace", true));
	deinterlaceAction->setShortcut(Qt::Key_I);
	connect(deinterlaceAction, SIGNAL(toggled(bool)), this, SLOT(deinterlacingChanged(bool)));
	backend->setDeinterlacing(deinterlaceAction->isChecked());
	videoMenu->addAction(collection->addAction(QLatin1String("controls_deinterlace"), deinterlaceAction));

	KMenu *aspectMenu = new KMenu(i18nc("'Video' menu", "Aspect Ratio"), this);
	QActionGroup *aspectGroup = new QActionGroup(this);
	connect(aspectGroup, SIGNAL(triggered(QAction*)),
		this, SLOT(aspectRatioChanged(QAction*)));

	action = new KAction(i18nc("'Aspect Ratio' menu", "Automatic"), aspectGroup);
	action->setCheckable(true);
	action->setChecked(true);
	action->setData(AspectRatioAuto);
	aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_auto"), action));

	action = new KAction(i18nc("'Aspect Ratio' menu", "Fit to Window"), aspectGroup);
	action->setCheckable(true);
	action->setData(AspectRatioWidget);
	aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_widget"), action));

	action = new KAction(i18nc("'Aspect Ratio' menu", "4:3"), aspectGroup);
	action->setCheckable(true);
	action->setData(AspectRatio4_3);
	aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_4_3"), action));

	action = new KAction(i18nc("'Aspect Ratio' menu", "16:9"), aspectGroup);
	action->setCheckable(true);
	action->setData(AspectRatio16_9);
	aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_16_9"), action));

    // Changes aspect ratio "a la VLC"
    currentAspectRatio=AspectRatioAuto;
    action = new KAction(KIcon(QLatin1String("chainAspectRatio")),
        i18nc("'Aspect Ratio' menu", "Chain ratio"), this);
    action->setShortcut(Qt::CTRL+Qt::Key_A);
    connect(action, SIGNAL(triggered()), this, SLOT(chainAspectRatio()));
    aspectMenu->addAction(collection->addAction(QLatin1String("chainAspectRatio"), action));
    // Switches scale "a la VLC"
    currentAspectRatio=AspectRatioAuto;
    action = new KAction(KIcon(QLatin1String("switchScale")),
        i18nc("'Aspect Ratio' menu", "Switch scale"), this);
    action->setShortcut(Qt::SHIFT+Qt::Key_O);
    connect(action, SIGNAL(triggered()), this, SLOT(switchScale()));
    aspectMenu->addAction(collection->addAction(QLatin1String("switchScale"), action));

    videoMenu->addMenu(aspectMenu);

	KMenu *autoResizeMenu = new KMenu(i18n("Automatic Resize"), this);
	QActionGroup *autoResizeGroup = new QActionGroup(this);
	// we need an event even if you select the currently selected item
	autoResizeGroup->setExclusive(false);
	connect(autoResizeGroup, SIGNAL(triggered(QAction*)),
		this, SLOT(autoResizeTriggered(QAction*)));

	action = new KAction(i18nc("automatic resize", "Off"), autoResizeGroup);
	action->setCheckable(true);
	action->setData(0);
	autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_off"), action));

	action = new KAction(i18nc("automatic resize", "Original Size"), autoResizeGroup);
	action->setCheckable(true);
	action->setData(1);
	autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_original"), action));

	action = new KAction(i18nc("automatic resize", "Double Size"), autoResizeGroup);
	action->setCheckable(true);
	action->setData(2);
	autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_double"), action));

	int autoResizeFactor =
		KGlobal::config()->group("MediaObject").readEntry("AutoResizeFactor", 0);

	switch (autoResizeFactor) {
	case 1:
		automaticResize = OriginalSize;
		autoResizeGroup->actions().at(1)->setChecked(true);
		break;
	case 2:
		automaticResize = DoubleSize;
		autoResizeGroup->actions().at(2)->setChecked(true);
		break;
	default:
		automaticResize = ResizeOff;
		autoResizeGroup->actions().at(0)->setChecked(true);
		break;
	}

	videoMenu->addMenu(autoResizeMenu);

    action = new KAction(i18n("Volume Slider"), this);
	volumeSlider = new QSlider(toolBar);
	volumeSlider->setFocusPolicy(Qt::NoFocus);
	volumeSlider->setOrientation(Qt::Horizontal);
    volumeSlider->setRange(0, 100);
	volumeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
	volumeSlider->setToolTip(action->text());
    volumeSlider->setValue(KGlobal::config()->group("MediaObject").readEntry("Volume", 100));
	connect(volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
	backend->setVolume(volumeSlider->value());
	action->setDefaultWidget(volumeSlider);
	toolBar->addAction(collection->addAction(QLatin1String("controls_volume_slider"), action));

	jumpToPositionAction = new KAction(KIcon(QLatin1String("go-jump")),
		i18nc("@action:inmenu", "Jump to Position..."), this);
	jumpToPositionAction->setShortcut(Qt::CTRL + Qt::Key_J);
	connect(jumpToPositionAction, SIGNAL(triggered()), this, SLOT(jumpToPosition()));
	menu->addAction(collection->addAction(QLatin1String("controls_jump_to_position"), jumpToPositionAction));

	navigationMenu = new KMenu(i18nc("playback menu", "Skip"), this);
	menu->addMenu(navigationMenu);
	menu->addSeparator();

	int shortSkipDuration = Configuration::instance()->getShortSkipDuration();
	int longSkipDuration = Configuration::instance()->getLongSkipDuration();
	connect(Configuration::instance(), SIGNAL(shortSkipDurationChanged(int)),
		this, SLOT(shortSkipDurationChanged(int)));
	connect(Configuration::instance(), SIGNAL(longSkipDurationChanged(int)),
		this, SLOT(longSkipDurationChanged(int)));

	longSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")),
		i18nc("submenu of 'Skip'", "Skip %1s Backward", longSkipDuration), this);
	longSkipBackwardAction->setShortcut(Qt::SHIFT + Qt::Key_Left);
	connect(longSkipBackwardAction, SIGNAL(triggered()), this, SLOT(longSkipBackward()));
	navigationMenu->addAction(
		collection->addAction(QLatin1String("controls_long_skip_backward"), longSkipBackwardAction));

	shortSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")),
		i18nc("submenu of 'Skip'", "Skip %1s Backward", shortSkipDuration), this);
	shortSkipBackwardAction->setShortcut(Qt::Key_Left);
	connect(shortSkipBackwardAction, SIGNAL(triggered()), this, SLOT(shortSkipBackward()));
	navigationMenu->addAction(
		collection->addAction(QLatin1String("controls_skip_backward"), shortSkipBackwardAction));

	shortSkipForwardAction = new KAction(KIcon(QLatin1String("media-skip-forward")),
		i18nc("submenu of 'Skip'", "Skip %1s Forward", shortSkipDuration), this);
	shortSkipForwardAction->setShortcut(Qt::Key_Right);
	connect(shortSkipForwardAction, SIGNAL(triggered()), this, SLOT(shortSkipForward()));
	navigationMenu->addAction(
		collection->addAction(QLatin1String("controls_skip_forward"), shortSkipForwardAction));

	longSkipForwardAction = new KAction(KIcon(QLatin1String("media-skip-forward")),
		i18nc("submenu of 'Skip'", "Skip %1s Forward", longSkipDuration), this);
	longSkipForwardAction->setShortcut(Qt::SHIFT + Qt::Key_Right);
	connect(longSkipForwardAction, SIGNAL(triggered()), this, SLOT(longSkipForward()));
	navigationMenu->addAction(
		collection->addAction(QLatin1String("controls_long_skip_forward"), longSkipForwardAction));

	toolBar->addAction(KIcon(QLatin1String("player-time")), i18n("Seek Slider"))->setEnabled(false);

	action = new KAction(i18n("Seek Slider"), this);
	seekSlider = new SeekSlider(toolBar);
	seekSlider->setFocusPolicy(Qt::NoFocus);
	seekSlider->setOrientation(Qt::Horizontal);
	seekSlider->setToolTip(action->text());
	connect(seekSlider, SIGNAL(valueChanged(int)), this, SLOT(seek(int)));
	action->setDefaultWidget(seekSlider);
	toolBar->addAction(collection->addAction(QLatin1String("controls_position_slider"), action));

	menuAction = new KAction(KIcon(QLatin1String("media-optical-video")),
		i18nc("dvd navigation", "DVD Menu"), this);
	connect(menuAction, SIGNAL(triggered()), this, SLOT(toggleMenu()));
	menu->addAction(collection->addAction(QLatin1String("controls_toggle_menu"), menuAction));

	titleMenu = new KMenu(i18nc("dvd navigation", "Title"), this);
	titleGroup = new QActionGroup(this);
	connect(titleGroup, SIGNAL(triggered(QAction*)),
		this, SLOT(currentTitleChanged(QAction*)));
	menu->addMenu(titleMenu);

	chapterMenu = new KMenu(i18nc("dvd navigation", "Chapter"), this);
	chapterGroup = new QActionGroup(this);
	connect(chapterGroup, SIGNAL(triggered(QAction*)),
		this, SLOT(currentChapterChanged(QAction*)));
	menu->addMenu(chapterMenu);

	angleMenu = new KMenu(i18nc("dvd navigation", "Angle"), this);
	angleGroup = new QActionGroup(this);
	connect(angleGroup, SIGNAL(triggered(QAction*)), this,
		SLOT(currentAngleChanged(QAction*)));
	menu->addMenu(angleMenu);

	action = new KAction(i18n("Switch between elapsed and remaining time display"), this);
	timeButton = new QPushButton(toolBar);
	timeButton->setFocusPolicy(Qt::NoFocus);
	timeButton->setToolTip(action->text());
	connect(timeButton, SIGNAL(clicked(bool)), this, SLOT(timeButtonClicked()));
	action->setDefaultWidget(timeButton);
	toolBar->addAction(collection->addAction(QLatin1String("controls_time_button"), action));

	QTimer *timer = new QTimer(this);
	timer->start(50000);
	connect(timer, SIGNAL(timeout()), this, SLOT(checkScreenSaver()));
}
Esempio n. 20
0
void AddressCluster::init()
{
    _list = new QPushButton(tr("..."), this);
    _list->setObjectName("_list");
    _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

#ifndef Q_WS_MAC
    _list->setMaximumWidth(25);
#else
    _list->setMinimumWidth(60);
    _list->setMinimumHeight(32);
#endif

    _titleSingular = tr("Address");
    _titlePlural   = tr("Addresses");
    _query = "SELECT * FROM address ";
    _searchAcctId = -1;

    // handle differences between VirtualCluster and AddressCluster
    _grid->removeWidget(_label);
    _grid->removeWidget(_description);
    delete _description;
    _description = 0;

    _addrChange    = new XLineEdit(this);
    _number        = new XLineEdit(this);
    _addrLit       = new QLabel(tr("Street\nAddress:"), this);
    _addr1         = new XLineEdit(this);
    _addr2         = new XLineEdit(this);
    _addr3         = new XLineEdit(this);
    _cityLit       = new QLabel(tr("City:"), this);
    _city          = new XLineEdit(this);
    _stateLit      = new QLabel(tr("State:"));
    _state         = new XComboBox(this, "_state");
    _postalcodeLit = new QLabel(tr("Postal Code:"));
    _postalcode    = new XLineEdit(this);
    _countryLit    = new QLabel(tr("Country:"));
    _country       = new XComboBox(this, "_country");
    _active        = new QCheckBox(tr("Active"), this);
    _mapper        = new XDataWidgetMapper(this);

    _addrChange->hide();
#if defined Q_OS_MAC   
    _city->setMinimumWidth(110);
#else
    _city->setMinimumWidth(85);
#endif
    if (! DEBUG)
      _number->hide();
    _addrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _cityLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _stateLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _state->setEditable(true);
    _state->setAllowNull(true);
    _country->setMaximumWidth(250);
    _country->setEditable(! (_x_metrics &&
                             _x_metrics->boolean("StrictAddressCountry")));
    if (DEBUG)
      qDebug("%s::_country.isEditable() = %d",
             (objectName().isEmpty() ? "AddressCluster":qPrintable(objectName())),
             _country->isEditable());

    _postalcodeLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _countryLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    _grid->setMargin(0);
    _grid->setSpacing(2);
    _grid->addWidget(_label,         0, 0, 1, -1);
    _grid->addWidget(_addrLit,       1, 0, 3, 1);
    _grid->addWidget(_addr1,         1, 1, 1, -1);
    _grid->addWidget(_addr2,         2, 1, 1, -1);
    _grid->addWidget(_addr3,         3, 1, 1, -1);
    _grid->addWidget(_cityLit,       4, 0);
    _grid->addWidget(_city,          4, 1);
    _grid->addWidget(_stateLit,      4, 2);
    _grid->addWidget(_state,         4, 3);
    _grid->addWidget(_postalcodeLit, 4, 4);
    _grid->addWidget(_postalcode,    4, 5, 1, 2);
    _grid->addWidget(_countryLit,    5, 0);
    _grid->addWidget(_country,       5, 1, 1, 3);
    _grid->addWidget(_active,        5, 4);

    QHBoxLayout* hbox = new QHBoxLayout;
    hbox->addWidget(_list);
    _grid->addLayout(hbox, 5, 5, 1, -1, Qt::AlignRight);

    _grid->setColumnStretch(0, 0);
    _grid->setColumnStretch(1, 3);
    _grid->setColumnStretch(2, 0);
    _grid->setColumnStretch(3, 1);
    _grid->setColumnStretch(4, 0);
    _grid->setColumnStretch(5, 2);

#if defined Q_WS_MAC
    setMinimumSize(_grid->columnCount() * 60, 132);
#endif

    connect(_list,      SIGNAL(clicked()), this, SLOT(sEllipses()));
    connect(_addr1,     SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_addr2,     SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_addr3,     SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_city,      SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_state, SIGNAL(editTextChanged(const QString&)), this, SIGNAL(changed()));
    connect(_state,                      SIGNAL(newID(int)), this, SIGNAL(changed()));
    connect(_postalcode,SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_country,SIGNAL(editTextChanged(const QString&)),this, SLOT(setCountry(const QString&)));
    connect(_country,                    SIGNAL(newID(int)), this, SIGNAL(changed()));
    connect(_country,                    SIGNAL(newID(int)), this, SLOT(populateStateComboBox()));

    connect(_addr1, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_addr2, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_addr3, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_city, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_postalcode, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_addr1, SIGNAL(requestSearch()), this, SLOT(sSearch()));
    connect(_addr2, SIGNAL(requestSearch()), this, SLOT(sSearch()));
    connect(_addr3, SIGNAL(requestSearch()), this, SLOT(sSearch()));
    connect(_city,  SIGNAL(requestSearch()), this, SLOT(sSearch()));
    connect(_postalcode,  SIGNAL(requestSearch()), this, SLOT(sSearch()));

    connect(_addr1,     SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));
    connect(_addr2,     SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));
    connect(_addr3,     SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));
    connect(_city,      SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));
    connect(_postalcode,SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));

    setFocusProxy(_addr1);
    setFocusPolicy(Qt::StrongFocus);
    setLabel("");
    setActiveVisible(false);
    silentSetId(-1);
    _list->show();
    _mode = Edit;
}
Esempio n. 21
0
DockWnd::DockWnd(QWidget *main)
        : QWidget(NULL, "dock",  WType_TopLevel | WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop)
{
    setMouseTracking(true);
    connect(this, SIGNAL(toggleWin()), main, SLOT(toggleShow()));
    connect(this, SIGNAL(showPopup(QPoint)), main, SLOT(showDockPopup(QPoint)));
    connect(this, SIGNAL(doubleClicked()), main, SLOT(dockDblClicked()));
    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(pMain, SIGNAL(iconChanged()), this, SLOT(reset()));
    connect(pMain, SIGNAL(msgChanged()), this, SLOT(reset()));
    m_state = 0;
    showIcon = State;
    QTimer *t = new QTimer(this);
    connect(t, SIGNAL(timeout()), this, SLOT(timer()));
    t->start(800);
    bNoToggle = false;
#ifdef WIN32
    QWidget::hide();
    QWidget::setIcon(Pict(pClient->getStatusIcon()));
    gDock = this;
    oldDockProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
    if (oldDockProc == 0)
        oldDockProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
    NOTIFYICONDATAA notifyIconData;
    notifyIconData.cbSize = sizeof(notifyIconData);
    notifyIconData.hIcon = topData()->winIcon;
    notifyIconData.hWnd = winId();
    notifyIconData.szTip[0] = 0;
    notifyIconData.uCallbackMessage = WM_DOCK;
    notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
    notifyIconData.uID = 0;
    Shell_NotifyIconA(NIM_ADD, &notifyIconData);
#else
    setMinimumSize(22, 22);
    resize(22, 22);
    bInit = false;
    inTray = false;
    inNetTray = false;

    Display *dsp = x11Display();
    WId win = winId();

    if (bEnlightenment){
        wharfIcon = NULL;
        bInit = true;
        resize(48, 48);
        setFocusPolicy(NoFocus);
        move(pMain->getDockX(), pMain->getDockY());
        reset();
        MWMHints mwm;
        mwm.flags = MWM_HINTS_DECORATIONS;
        mwm.functions = 0;
        mwm.decorations = 0;
        mwm.inputMode = 0;
        mwm.status = 0;
        Atom a = XInternAtom(dsp, "_MOTIF_WM_HINTS", False);
        XChangeProperty(dsp, win, a, a, 32, PropModeReplace,
                        (unsigned char *)&mwm, sizeof(MWMHints) / 4);
        XStoreName(dsp, win, "SIM");
        XClassHint *xch = XAllocClassHint();
        xch->res_name  = (char*)"SIM";
        xch->res_class = (char*)"Epplet";
        XSetClassHint(dsp, win, xch);
        XFree(xch);
        XSetIconName(dsp, win, "SIM");
        unsigned long val = (1 << 0) /* | (1 << 9) */ ;
        a = XInternAtom(dsp, "_WIN_STATE", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        val = 2;
        a = XInternAtom(dsp, "_WIN_LAYER", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        val = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 5);
        a = XInternAtom(dsp, "_WIN_HINTS", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        win_name = "SIM";
        win_version = VERSION;
        win_info = "";
        while (!comms_win)
        {
            ECommsSetup(dsp);
            sleep(1);
        }
        char s[256];
        snprintf(s, sizeof(s), "set clientname %s", win_name);
        ECommsSend(s);
        snprintf(s, sizeof(s), "set version %s", win_version);
        ECommsSend(s);
        snprintf(s, sizeof(s), "set info %s", win_info);
        ECommsSend(s);
        ESYNC;

        set_background_properties(this);

        show();
        return;
    }

    wharfIcon = new WharfIcon(this);

    setBackgroundMode(X11ParentRelative);
    const QPixmap &pict = Pict(pClient->getStatusIcon());
    setIcon(pict);

    XClassHint classhint;
    classhint.res_name  = (char*)"sim";
    classhint.res_class = (char*)"Wharf";
    XSetClassHint(dsp, win, &classhint);

    Screen *screen = XDefaultScreenOfDisplay(dsp);
    int screen_id = XScreenNumberOfScreen(screen);
    char buf[32];
    snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", screen_id);
    Atom selection_atom = XInternAtom(dsp, buf, false);
    XGrabServer(dsp);
    Window manager_window = XGetSelectionOwner(dsp, selection_atom);
    if (manager_window != None)
        XSelectInput(dsp, manager_window, StructureNotifyMask);
    XUngrabServer(dsp);
    XFlush(dsp);
    if (manager_window != None){
        inNetTray = true;
        if (!send_message(dsp, manager_window, SYSTEM_TRAY_REQUEST_DOCK, win, 0, 0)){
            inNetTray = false;
        }
    }

    Atom kde_net_system_tray_window_for_atom = XInternAtom(dsp, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", false);

    long data[1];
    data[0] = 0;
    XChangeProperty(dsp, win, kde_net_system_tray_window_for_atom, XA_WINDOW,
                    32, PropModeReplace,
                    (unsigned char*)data, 1);

    XWMHints *hints;
    hints = XGetWMHints(dsp, win);
    hints->initial_state = WithdrawnState;
    hints->icon_x = 0;
    hints->icon_y = 0;
    hints->icon_window = wharfIcon->winId();
    hints->window_group = win;
    hints->flags = WindowGroupHint | IconWindowHint | IconPositionHint | StateHint;
    XSetWMHints(dsp, win, hints);
    XFree( hints );
    XSetCommand(dsp, win, _argv, _argc);

    if (!inNetTray){
        move(-21, -21);
        resize(22, 22);
    }
    show();
#endif
    reset();
}
Esempio n. 22
0
CloseButton::CloseButton(QWidget *AParent) : QAbstractButton(AParent)
{
	setFocusPolicy(Qt::NoFocus);
	setCursor(Qt::ArrowCursor);
	resize(sizeHint());
}
Esempio n. 23
0
//------------------------------------------------------------------------------
View3D::View3D(GeometryCollection* geometries, const QGLFormat& format, QWidget *parent)
    : QGLWidget(format, parent),
    m_camera(false, false),
    m_mouseButton(Qt::NoButton),
    m_explicitCursorPos(false),
    m_cursorPos(0),
    m_prevCursorSnap(0),
    m_backgroundColor(60, 50, 50),
    m_drawBoundingBoxes(true),
    m_drawCursor(true),
    m_drawAxes(true),
    m_drawGrid(false),
    m_badOpenGL(false),
    m_shaderProgram(),
    m_geometries(geometries),
    m_selectionModel(0),
    m_shaderParamsUI(0),
    m_incrementalFrameTimer(0),
    m_incrementalFramebuffer(0),
    m_incrementalDraw(false),
    m_drawAxesBackground(QImage(":/resource/axes.png")),
    m_drawAxesLabelX(QImage(":/resource/x.png")),
    m_drawAxesLabelY(QImage(":/resource/y.png")),
    m_drawAxesLabelZ(QImage(":/resource/z.png")),
    m_cursorVertexArray(0),
    m_axesVertexArray(0),
    m_gridVertexArray(0),
    m_quadVertexArray(0),
    m_quadLabelVertexArray(0),
    m_devicePixelRatio(1.0)
{
    connect(m_geometries, SIGNAL(layoutChanged()),                      this, SLOT(geometryChanged()));
    //connect(m_geometries, SIGNAL(destroyed()),                          this, SLOT(modelDestroyed()));
    connect(m_geometries, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(geometryChanged()));
    connect(m_geometries, SIGNAL(rowsInserted(QModelIndex,int,int)),    this, SLOT(geometryInserted(const QModelIndex&, int,int)));
    connect(m_geometries, SIGNAL(rowsRemoved(QModelIndex,int,int)),     this, SLOT(geometryChanged()));

    setSelectionModel(new QItemSelectionModel(m_geometries, this));

    setFocusPolicy(Qt::StrongFocus);
    setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    setFocus();

    m_camera.setClipFar(FLT_MAX*0.5f); //using FLT_MAX appears to cause issues under OS X for Qt to handle
    // Setting a good value for the near camera clipping plane is difficult
    // when trying to show a large variation of length scales:  Setting a very
    // small value allows us to see objects very close to the camera; the
    // tradeoff is that this reduces the resolution of the z-buffer leading to
    // z-fighting in the distance.
    m_camera.setClipNear(1);
    connect(&m_camera, SIGNAL(projectionChanged()), this, SLOT(restartRender()));
    connect(&m_camera, SIGNAL(viewChanged()), this, SLOT(restartRender()));

    makeCurrent();
    m_shaderProgram.reset(new ShaderProgram());
    connect(m_shaderProgram.get(), SIGNAL(uniformValuesChanged()),
            this, SLOT(restartRender()));
    connect(m_shaderProgram.get(), SIGNAL(shaderChanged()),
            this, SLOT(restartRender()));
    connect(m_shaderProgram.get(), SIGNAL(paramsChanged()),
            this, SLOT(setupShaderParamUI()));

    m_incrementalFrameTimer = new QTimer(this);
    m_incrementalFrameTimer->setSingleShot(false);
    connect(m_incrementalFrameTimer, SIGNAL(timeout()), this, SLOT(updateGL()));
}
Esempio n. 24
0
 Wheel( WheelBox *parent ):
     QwtWheel( parent )
 {
     setFocusPolicy( Qt::WheelFocus );
     parent->installEventFilter( this );
 }
Esempio n. 25
0
/*
 *  Constructs a CropToolPopup as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
CropToolPopup::CropToolPopup( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "CropToolPopup" );
    setFocusPolicy( QDialog::StrongFocus );

    textLabel1_2 = new QLabel( this, "textLabel1_2" );
    textLabel1_2->setGeometry( QRect( 260, 10, 20, 21 ) );

    textLabel1 = new QLabel( this, "textLabel1" );
    textLabel1->setGeometry( QRect( 190, 10, 20, 21 ) );

    textLabel1_3_2_2_2 = new QLabel( this, "textLabel1_3_2_2_2" );
    textLabel1_3_2_2_2->setGeometry( QRect( 10, 10, 37, 21 ) );

    textLabel1_3 = new QLabel( this, "textLabel1_3" );
    textLabel1_3->setGeometry( QRect( 330, 10, 20, 21 ) );

    CropToolType2 = new QComboBox( FALSE, this, "CropToolType2" );
    CropToolType2->setGeometry( QRect( 0, 100, 90, 21 ) );

    CropToolType3 = new QComboBox( FALSE, this, "CropToolType3" );
    CropToolType3->setGeometry( QRect( 0, 160, 90, 21 ) );

    Yval1 = new QSpinBox( this, "Yval1" );
    Yval1->setGeometry( QRect( 240, 40, 59, 21 ) );
    Yval1->setMaxValue( 10000 );
    Yval1->setMinValue( -10000 );

    Zval1 = new QSpinBox( this, "Zval1" );
    Zval1->setGeometry( QRect( 310, 40, 59, 21 ) );
    Zval1->setMaxValue( 10000 );
    Zval1->setMinValue( -10000 );

    Xval2 = new QSpinBox( this, "Xval2" );
    Xval2->setGeometry( QRect( 170, 100, 59, 21 ) );
    Xval2->setMaxValue( 10000 );
    Xval2->setMinValue( -10000 );

    Yval2 = new QSpinBox( this, "Yval2" );
    Yval2->setGeometry( QRect( 240, 100, 59, 21 ) );
    Yval2->setMaxValue( 10000 );
    Yval2->setMinValue( -10000 );

    Zval2 = new QSpinBox( this, "Zval2" );
    Zval2->setGeometry( QRect( 310, 100, 59, 21 ) );
    Zval2->setMaxValue( 10000 );
    Zval2->setMinValue( -10000 );

    Xval3 = new QSpinBox( this, "Xval3" );
    Xval3->setGeometry( QRect( 170, 160, 59, 21 ) );
    Xval3->setMaxValue( 10000 );
    Xval3->setMinValue( -10000 );

    Yval3 = new QSpinBox( this, "Yval3" );
    Yval3->setGeometry( QRect( 240, 160, 59, 21 ) );
    Yval3->setMaxValue( 10000 );
    Yval3->setMinValue( -10000 );

    Zval3 = new QSpinBox( this, "Zval3" );
    Zval3->setGeometry( QRect( 310, 160, 59, 21 ) );
    Zval3->setMaxValue( 10000 );
    Zval3->setMinValue( -10000 );

    textLabel1_3_2 = new QLabel( this, "textLabel1_3_2" );
    textLabel1_3_2->setGeometry( QRect( 400, 10, 37, 21 ) );

    textLabel1_3_2_3 = new QLabel( this, "textLabel1_3_2_3" );
    textLabel1_3_2_3->setGeometry( QRect( 460, 10, 37, 21 ) );

    Rev1 = new QCheckBox( this, "Rev1" );
    Rev1->setGeometry( QRect( 470, 40, 20, 20 ) );

    Rev2 = new QCheckBox( this, "Rev2" );
    Rev2->setGeometry( QRect( 470, 100, 20, 20 ) );

    Rev3 = new QCheckBox( this, "Rev3" );
    Rev3->setGeometry( QRect( 470, 160, 20, 20 ) );

    radius3 = new QSpinBox( this, "radius3" );
    radius3->setGeometry( QRect( 100, 160, 59, 21 ) );
    radius3->setMaxValue( 10000 );
    radius3->setMinValue( 0 );
    radius3->setValue( 1 );

    radius2 = new QSpinBox( this, "radius2" );
    radius2->setGeometry( QRect( 100, 100, 59, 21 ) );
    radius2->setMaxValue( 10000 );
    radius2->setMinValue( 0 );
    radius2->setValue( 1 );

    radius1 = new QSpinBox( this, "radius1" );
    radius1->setGeometry( QRect( 100, 40, 59, 21 ) );
    radius1->setMaxValue( 10000 );
    radius1->setMinValue( 0 );
    radius1->setValue( 1 );

    textLabel1_3_2_2 = new QLabel( this, "textLabel1_3_2_2" );
    textLabel1_3_2_2->setGeometry( QRect( 110, 10, 30, 21 ) );

    CropToolType1 = new QComboBox( FALSE, this, "CropToolType1" );
    CropToolType1->setGeometry( QRect( 0, 40, 90, 21 ) );

    Xval1 = new QSpinBox( this, "Xval1" );
    Xval1->setGeometry( QRect( 170, 40, 59, 21 ) );
    Xval1->setMaxValue( 10000 );
    Xval1->setMinValue( -10000 );

    Rot1a = new QSpinBox( this, "Rot1a" );
    Rot1a->setGeometry( QRect( 390, 40, 59, 21 ) );
    Rot1a->setMaxValue( 180 );
    Rot1a->setMinValue( -180 );
    Rot1a->setLineStep( 5 );

    Rot1b = new QSpinBox( this, "Rot1b" );
    Rot1b->setGeometry( QRect( 390, 60, 59, 21 ) );
    Rot1b->setMaxValue( 180 );
    Rot1b->setMinValue( -180 );
    Rot1b->setLineStep( 5 );

    Rot2a = new QSpinBox( this, "Rot2a" );
    Rot2a->setGeometry( QRect( 390, 100, 59, 21 ) );
    Rot2a->setMaxValue( 180 );
    Rot2a->setMinValue( -180 );
    Rot2a->setLineStep( 5 );

    Rot2b = new QSpinBox( this, "Rot2b" );
    Rot2b->setGeometry( QRect( 390, 120, 59, 21 ) );
    Rot2b->setMaxValue( 180 );
    Rot2b->setMinValue( -180 );
    Rot2b->setLineStep( 5 );

    Rot3a = new QSpinBox( this, "Rot3a" );
    Rot3a->setGeometry( QRect( 390, 160, 59, 21 ) );
    Rot3a->setMaxValue( 180 );
    Rot3a->setMinValue( -180 );
    Rot3a->setLineStep( 5 );

    Rot3b = new QSpinBox( this, "Rot3b" );
    Rot3b->setGeometry( QRect( 390, 180, 59, 21 ) );
    Rot3b->setMaxValue( 180 );
    Rot3b->setMinValue( -180 );
    Rot3b->setLineStep( 5 );
    languageChange();
    resize( QSize(511, 220).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( radius1, SIGNAL( valueChanged(int) ), this, SLOT( radius1_valueChanged(int) ) );
    connect( Xval1, SIGNAL( valueChanged(int) ), this, SLOT( Xval1_valueChanged(int) ) );
    connect( Yval1, SIGNAL( valueChanged(int) ), this, SLOT( Yval1_valueChanged(int) ) );
    connect( Zval1, SIGNAL( valueChanged(int) ), this, SLOT( Zval1_valueChanged(int) ) );
    connect( Rot1a, SIGNAL( valueChanged(int) ), this, SLOT( Rot1a_valueChanged(int) ) );
    connect( Rot1b, SIGNAL( valueChanged(int) ), this, SLOT( Rot1b_valueChanged(int) ) );
    connect( radius2, SIGNAL( valueChanged(int) ), this, SLOT( radius2_valueChanged(int) ) );
    connect( Xval2, SIGNAL( valueChanged(int) ), this, SLOT( Xval2_valueChanged(int) ) );
    connect( Yval2, SIGNAL( valueChanged(int) ), this, SLOT( Yval2_valueChanged(int) ) );
    connect( Zval2, SIGNAL( valueChanged(int) ), this, SLOT( Zval2_valueChanged(int) ) );
    connect( Rot2a, SIGNAL( valueChanged(int) ), this, SLOT( Rot2a_valueChanged(int) ) );
    connect( Rot2b, SIGNAL( valueChanged(int) ), this, SLOT( Rot2b_valueChanged(int) ) );
    connect( radius3, SIGNAL( valueChanged(int) ), this, SLOT( radius3_valueChanged(int) ) );
    connect( Xval3, SIGNAL( valueChanged(int) ), this, SLOT( Xval3_valueChanged(int) ) );
    connect( Yval3, SIGNAL( valueChanged(int) ), this, SLOT( Yval3_valueChanged(int) ) );
    connect( Zval3, SIGNAL( valueChanged(int) ), this, SLOT( Zval3_valueChanged(int) ) );
    connect( Rot3a, SIGNAL( valueChanged(int) ), this, SLOT( Rot3a_valueChanged(int) ) );
    connect( Rot3b, SIGNAL( valueChanged(int) ), this, SLOT( Rot3b_valueChanged(int) ) );
    connect( Rev1, SIGNAL( toggled(bool) ), this, SLOT( Rev1_toggled(bool) ) );
    connect( Rev2, SIGNAL( toggled(bool) ), this, SLOT( Rev2_toggled(bool) ) );
    connect( Rev3, SIGNAL( toggled(bool) ), this, SLOT( Rev3_toggled(bool) ) );
    connect( CropToolType1, SIGNAL( highlighted(int) ), this, SLOT( CropToolType1_highlighted(int) ) );
    connect( CropToolType2, SIGNAL( highlighted(int) ), this, SLOT( CropToolType2_highlighted(int) ) );
    connect( CropToolType3, SIGNAL( highlighted(int) ), this, SLOT( CropToolType3_highlighted(int) ) );
    init();
}
Esempio n. 26
0
GameButton::GameButton(QWidget *parent) : QPushButton(parent)
{
	setFocusPolicy(Qt::NoFocus);
	setEnabled(false);
}
Esempio n. 27
0
AdapterWidget::AdapterWidget( QWidget * parent, const char * name, const QGLWidget * shareWidget, WindowFlags f):
    QGLWidget(parent, shareWidget, f)
{
    _gw = new osgViewer::GraphicsWindowEmbedded(0,0,width(),height());
    setFocusPolicy(Qt::ClickFocus);
}
Esempio n. 28
0
Icon::Icon(TaskManager::AbstractGroupableItem *abstractItem, Launcher *launcher, Job *job, Applet *parent) : QGraphicsWidget(parent),
    m_applet(parent),
    m_task(NULL),
    m_launcher(NULL),
    m_glowEffect(NULL),
    m_layout(new QGraphicsLinearLayout(this)),
    m_animationTimeLine(new QTimeLine(1000, this)),
    m_jobAnimationTimeLine(NULL),
    m_itemType(TypeOther),
    m_factor(parent->initialFactor()),
    m_animationProgress(-1),
    m_jobsProgress(0),
    m_jobsAnimationProgress(0),
    m_dragTimer(0),
    m_highlightTimer(0),
    m_menuVisible(false),
    m_demandsAttention(false),
    m_jobsRunning(false),
    m_isVisible(true),
    m_isPressed(false)
{
    setObjectName("FancyTasksIcon");

    setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));

    setAcceptsHoverEvents(true);

    setAcceptDrops(true);

    setFocusPolicy(Qt::StrongFocus);

    setFlag(QGraphicsItem::ItemIsFocusable);

    setLayout(m_layout);

    m_visualizationPixmap = NULL;

    m_thumbnailPixmap = NULL;

    m_animationTimeLine->setFrameRange(0, 100);
    m_animationTimeLine->setUpdateInterval(50);
    m_animationTimeLine->setCurveShape(QTimeLine::LinearCurve);

    m_layout->setOrientation((m_applet->location() == Plasma::LeftEdge || m_applet->location() == Plasma::RightEdge)?Qt::Vertical:Qt::Horizontal);
    m_layout->addStretch();
    m_layout->addStretch();

    if (abstractItem)
    {
        setTask(abstractItem);
    }
    else if (launcher)
    {
        setLauncher(launcher);
    }
    else if (job)
    {
        addJob(job);
    }

    connect(this, SIGNAL(destroyed()), m_applet, SLOT(updateSize()));
    connect(this, SIGNAL(hoverMoved(QGraphicsWidget*, qreal)), m_applet, SLOT(itemHoverMoved(QGraphicsWidget*, qreal)));
    connect(this, SIGNAL(hoverLeft()), m_applet, SLOT(hoverLeft()));
    connect(m_applet, SIGNAL(sizeChanged(qreal)), this, SLOT(setSize(qreal)));
    connect(m_applet, SIGNAL(sizeChanged(qreal)), this, SIGNAL(sizeChanged(qreal)));
    connect(m_animationTimeLine, SIGNAL(finished()), this, SLOT(stopAnimation()));
    connect(m_animationTimeLine, SIGNAL(frameChanged(int)), this, SLOT(progressAnimation(int)));
}
Esempio n. 29
0
GameView::GameView(const QGLFormat& format, QWidget *parent)
: QGLWidget(format, parent), _time_accumulator(0.0f), _timer_id(0)
{
    setFocusPolicy(Qt::StrongFocus);
}
Esempio n. 30
0
void VirtualCluster::init()
{
    setFocusPolicy(Qt::StrongFocus);
    _label = new QLabel(this, "_label");
    _label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    // TODO: Remove _list and _info, but they are still used by a couple clusters
    //       Move them up perhaps?

    _list = new QPushButton(tr("..."), this, "_list");
    _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

#ifndef Q_WS_MAC
        _list->setMaximumWidth(25);
#else
    _list->setMinimumWidth(60);
    _list->setMinimumHeight(32);
#endif
    _info = new QPushButton("?", this, "_info");
    _info->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    _info->setEnabled(false);
#ifndef Q_WS_MAC
    _info->setMaximumWidth(25);
#else
    _info->setMinimumWidth(60);
    _info->setMinimumHeight(32);
#endif
    if (_x_preferences)
    {
      if (!_x_preferences->boolean("ClusterButtons"))
      {
        _list->hide();
        _info->hide();
      }
    }

    _name = new QLabel(this, "_name");
    _name->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    _name->setVisible(false);

    _description = new QLabel(this, "_description");
    _description->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    _description->setVisible(false);

    _grid = new QGridLayout(this);
    _grid->setMargin(0);
    _grid->setSpacing(6);
    _grid->addWidget(_label,  0, 0);
    _grid->addWidget(_list,   0, 2);
    _grid->addWidget(_info,   0, 3);
    _grid->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), 0, 4);
    _grid->addWidget(_name,   1, 1, 1, -1);
    _grid->addWidget(_description, 2, 1, 1, -1);

    _grid->setColumnMinimumWidth(0, 0);
    _grid->setColumnMinimumWidth(2, 0);
    _grid->setColumnMinimumWidth(3, 0);

    _grid->setRowMinimumHeight(0, 0);
    _grid->setRowMinimumHeight(1, 0);
    _grid->setRowMinimumHeight(2, 0);
    
    _mapper = new XDataWidgetMapper(this);
}