コード例 #1
0
ファイル: moc_mapcontrol.cpp プロジェクト: s0lstice/carto-qt
int qmapcontrol::MapControl::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: mouseEventCoordinate((*reinterpret_cast< const QMouseEvent*(*)>(_a[1])),(*reinterpret_cast< const QPointF(*)>(_a[2]))); break;
        case 1: boxDragged((*reinterpret_cast< const QRectF(*)>(_a[1]))); break;
        case 2: geometryClicked((*reinterpret_cast< Geometry*(*)>(_a[1])),(*reinterpret_cast< QPoint(*)>(_a[2]))); break;
        case 3: viewChanged((*reinterpret_cast< const QPointF(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 4: zoomIn(); break;
        case 5: zoomOut(); break;
        case 6: setZoom((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: scrollLeft((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 8: scrollLeft(); break;
        case 9: scrollRight((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 10: scrollRight(); break;
        case 11: scrollUp((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 12: scrollUp(); break;
        case 13: scrollDown((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 14: scrollDown(); break;
        case 15: scroll((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 16: updateRequest((*reinterpret_cast< QRect(*)>(_a[1]))); break;
        case 17: updateRequestNew(); break;
        case 18: resize((*reinterpret_cast< const QSize(*)>(_a[1]))); break;
        case 19: tick(); break;
        case 20: loadingFinished(); break;
        case 21: positionChanged((*reinterpret_cast< Geometry*(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 22;
    }
    return _id;
}
コード例 #2
0
ファイル: imageview.cpp プロジェクト: lanterrt/QAView
void
ImageView::prevPage()
{
    switch (m_scrollMode) {
    case IVPM_DOWN_RIGHT:
        if (scrollLeft() || scrollUp()) return;
        break;
    case IVPM_DOWN_LEFT:
        if (scrollRight() || scrollUp()) return;
        break;
    case IVPM_RIGHT_DOWN:
        if (scrollUp() || scrollLeft()) return;
        break;
    case IVPM_LEFT_DOWN:
        if (scrollUp() || scrollRight()) return;
        break;
    }
    switch (m_pageMode) {
    case IVPM_RIGHT_DOWN:
        if (upSlice() || leftSlice()) return;
        break;
    case IVPM_LEFT_DOWN:
        if (upSlice() || rightSlice()) return;
        break;
    case IVPM_DOWN_RIGHT:
        if (leftSlice() || upSlice()) return;
        break;
    case IVPM_DOWN_LEFT:
        if (rightSlice() || upSlice()) return;
        break;
    }

    emit loadPrev();
}
コード例 #3
0
ファイル: CMap.cpp プロジェクト: Shayster/Commander-Genius
////
// Scrolling Routines
////
bool CMap::gotoPos(int x, int y)
{
	int dx,dy;
	bool retval = false;
	dx = x - m_scrollx;
	dy = y - m_scrolly;
	
	if( dx > 0 )
		for( int scrollx=0 ; scrollx<dx ; scrollx++) scrollRight(true);
	else retval = true;
	
	if( dx < 0 )
		for( int scrollx=0 ; scrollx<-dx ; scrollx++) scrollLeft(true);
	else retval = true;
	
	if( dy > 0 )
		for( int scrolly=0 ; scrolly<dy ; scrolly++) scrollDown(true);
	else retval = true;
	
	if( dy < 0 )
		for( int scrolly=0 ; scrolly<-dy ; scrolly++) scrollUp(true);
	else retval = true;

	return retval;
}
コード例 #4
0
ファイル: tabbar.cpp プロジェクト: antofik/RedHelper
TabBar::TabBar(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TabBar)
{
    enter
    ui->setupUi(this);
    ui->cmdScrollLeft->hide();
    ui->cmdScrollRight->hide();

    QHBoxLayout *layout = new QHBoxLayout();
    layout->addItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Expanding));
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(2);
    ui->scrollContent->setLayout(layout);

    ui->cmdScrollLeft->hide();
    ui->cmdScrollRight->hide();
    ui->scroll->adjustSize();
    ui->scrollContent->adjustSize();
    updateScrollButtonsVisibility();

    connect(Core::ui(), SIGNAL(createTab(QString, bool)), SLOT(createTab(QString, bool)));
    connect(Core::ui(), SIGNAL(activateTab(QString)), SLOT(activateTab(QString)));
    connect(Core::ui(), SIGNAL(setTabName(QString,QString)), SLOT(setTabName(QString,QString)));
    connect(Core::ui(), SIGNAL(setTabIcon(QString,QString)), SLOT(setTabIcon(QString,QString)));
    connect(Core::ui(), SIGNAL(highlight(QString)), SLOT(highlight(QString)));
    connect(Core::ui(), SIGNAL(closeTab(QString)), SLOT(closeTab(QString)));
    connect(ui->cmdScrollLeft, SIGNAL(clicked()), SLOT(scrollLeft()));
    connect(ui->cmdScrollRight, SIGNAL(clicked()), SLOT(scrollRight()));
    leave
}
コード例 #5
0
ファイル: EditboxView.cpp プロジェクト: ZoriaRPG/ZeldaClassic
bool EditboxNoWrapView::mouseDragOther(int x, int)
{
    //maybe pressing arrow, or sliding?
    if(leftarrow_state == 1)
    {
        scrollLeft();
        return true;
    }
    
    if(rightarrow_state == 1)
    {
        scrollRight();
        return true;
    }
    
    if(hbarstate == 1)
    {
        //fake a click
        //first, clip the coords
        int fakey = leftarrow_y+1;
        return mouseClick(x,fakey);
    }
    
    return false;
}
コード例 #6
0
ファイル: pet_glyphs.cpp プロジェクト: OmerMor/scummvm
void CPetGlyphs::incSelection() {
	if (_highlightIndex >= 0 && _highlightIndex < ((int)size() - 1)) {
		if (getHighlightedIndex(_highlightIndex) >= (_numVisibleGlyphs - 1))
			scrollRight();

		changeHighlight(_highlightIndex + 1);
		makePetDirty();
	}
}
コード例 #7
0
ファイル: imageview.cpp プロジェクト: lanterrt/QAView
void
ImageView::nextPage()
{
    int xoff, yoff, xsl, ysl;
    xoff = m_xoffset;
    yoff = m_yoffset;
    xsl = m_xslice;
    ysl = m_yslice;
    switch (m_scrollMode) {
    case IVPM_DOWN_RIGHT:
        if (scrollDown() || scrollRight()) return;
        break;
    case IVPM_DOWN_LEFT:
        if (scrollDown() || scrollLeft()) return;
        break;
    case IVPM_RIGHT_DOWN:
        if (scrollRight() || scrollDown()) return;
        break;
    case IVPM_LEFT_DOWN:
        if (scrollLeft() || scrollDown()) return;
        break;
    }
    switch (m_pageMode) {
    case IVPM_RIGHT_DOWN:
        if (rightSlice() || downSlice()) return;
        break;
    case IVPM_LEFT_DOWN:
        if (leftSlice() || downSlice()) return;
        break;
    case IVPM_DOWN_RIGHT:
        if (downSlice() || rightSlice()) return;
        break;
    case IVPM_DOWN_LEFT:
        if (downSlice() || leftSlice()) return;
        break;
    }
    m_xoffset = xoff;
    m_yoffset = yoff;
    m_xslice = xsl;
    m_yslice = ysl;
    emit loadNext();
}
コード例 #8
0
ファイル: TextEdit.cpp プロジェクト: tokar1/mech-math
void TextEdit::scrollToCursor() {
    if (cursorX < windowX) {
        scrollLeft(windowX - cursorX);
    } else if (cursorX > windowX + windowWidth - 1) {
        scrollRight(cursorX - (windowX + windowWidth - 1));
    }

    if (cursorY < windowY) {
        scrollUp(windowY - cursorY);
    } else if (cursorY > windowY + windowHeight - 1) {
        scrollDown(cursorY - (windowY + windowHeight - 1));
    }
}
コード例 #9
0
//! called if an event happened.
bool CGUITabControl::OnEvent(const SEvent& event)
{
	if (IsEnabled)
	{

		switch(event.EventType)
		{
		case EET_GUI_EVENT:
			switch(event.GUIEvent.EventType)
			{
			case EGET_BUTTON_CLICKED:
				if (event.GUIEvent.Caller == UpButton)
				{
					scrollLeft();
					return true;
				}
				else if (event.GUIEvent.Caller == DownButton)
				{
					scrollRight();
					return true;
				}

			break;
			default:
			break;
			}
			break;
		case EET_MOUSE_INPUT_EVENT:
			switch(event.MouseInput.Event)
			{
			case EMIE_LMOUSE_PRESSED_DOWN:
				// todo: dragging tabs around
				return true;
			case EMIE_LMOUSE_LEFT_UP:
				if (selectTab(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y)))
					return true;
				break;
			default:
				break;
			}
			break;
		default:
			break;
		}
	}

	return IGUIElement::OnEvent(event);
}
コード例 #10
0
ファイル: pet_glyphs.cpp プロジェクト: OmerMor/scummvm
bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) {
	if (_scrollLeft.contains2(pt)) {
		scrollLeft();
		return true;
	}

	if (_scrollRight.contains2(pt)) {
		scrollRight();
		return true;
	}

	for (int idx = 0; idx < _numVisibleGlyphs; ++idx) {
		Rect glyphRect = getRect(idx);
		if (glyphRect.contains(pt)) {
			int index = getItemIndex(idx);
			CPetGlyph *glyph = getGlyph(index);
			if (glyph) {
				if (_highlightIndex == index) {
					glyph->selectGlyph(glyphRect, pt);
					glyph->updateTooltip();
				} else {
					changeHighlight(index);
					makePetDirty();
				}

				return true;
			}
		}
	}

	if (_highlightIndex != -1) {
		CPetGlyph *glyph = getGlyph(_highlightIndex);

		if (glyph) {
			if (glyph->MouseButtonDownMsg(pt))
				return true;

			if (!(_flags & GFLAG_2)) {
				changeHighlight(-1);
				makePetDirty();
			}
		}
	}

	return false;
}
コード例 #11
0
BOOL CZoomDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) {
#ifdef __NEVER__
  if (nFlags & MK_CONTROL) {
    if(zDelta > 0) {
      scrollRight();
    } else {
      scrollLeft();
    }
  } else
#endif
  if(zDelta > 0) {
    zoomIn();
  } else {
    zoomOut();
  }
  return __super::OnMouseWheel(nFlags, zDelta, pt);
}
コード例 #12
0
ファイル: HScrollBar.cpp プロジェクト: jmasterx/Agui
	void HScrollBar::handleAutoscroll( double timeElapsed )
	{
		if(lastArrowTick == -1)
		{
			lastArrowTick = timeElapsed + autoScrollStartInterval;
		}
		else if(timeElapsed > lastArrowTick)
		{
			if(leftArrowDown)
			{
				scrollLeft();
			}

			if(rightArrowDown)
			{
				scrollRight();
			}
		}
	}
コード例 #13
0
ファイル: pageView.cpp プロジェクト: serghei/kde3-kdegraphics
void PageView::keyPressEvent( QKeyEvent* e )
{
  switch ( e->key() ) {
    case Key_Up:
      scrollUp();
      break;
    case Key_Down:
      scrollDown();
      break;
    case Key_Left:
      scrollLeft();
      break;
    case Key_Right:
      scrollRight();
      break;
    default:
      e->ignore();
      return;
  }
  e->accept();
}
コード例 #14
0
void GRIHist1DGridScrollWidget::mousePressEvent(QMouseEvent *event) {
  if (event->button() == Qt::LeftButton) {
    int x = event->x();
    int y = event->y();
    if ((0 <= x) && (x <= window_margin_L_)
        && (window_margin_T_ <= y) && (y <= height() - window_margin_B_)) {
      scrollLeft();
    }
    else if ((width() - window_margin_R_<=x) && (x <= width())
             && (window_margin_T_ <= y) && (y <= height() - window_margin_B_)) {
      scrollRight();
    }
    else if ((window_margin_L_ <= x) && (x <= width() - window_margin_R_)
             && (0 <= y) && ( y<= window_margin_T_)) {
      scrollUp();
    }
    else if ((window_margin_L_ <= x) && (x <= width() - window_margin_R_)
             && (height() - window_margin_B_ <= y) && (y <= height())) {
      scrollDown();
    }
  }
}
コード例 #15
0
////
// Scrolling Routines
////
bool CMap::gotoPos(int x, int y)
{
	int dx,dy;
	bool retval = false;
	dx = x - m_scrollx;
	dy = y - m_scrolly;

	if( dx > 0 )
    {
        for( int scrollx=0 ; scrollx<dx ; scrollx++)
        {
            scrollRight(true);
        }
    }
    else
    {
        retval = true;
    }

	if( dx < 0 )
		for( int scrollx=0 ; scrollx<-dx ; scrollx++) scrollLeft(true);
	else retval = true;

	if( dy > 0 )
		for( int scrolly=0 ; scrolly<dy ; scrolly++) scrollDown(true);
	else retval = true;

	if( dy < 0 )
		for( int scrolly=0 ; scrolly<-dy ; scrolly++) scrollUp(true);
	else retval = true;

    calcVisibleArea();
    refreshVisibleArea();

	return retval;
}
コード例 #16
0
ファイル: EditboxView.cpp プロジェクト: ZoriaRPG/ZeldaClassic
bool EditboxNoWrapView::mouseClickOther(int x, int y)
{
    if(leftarrow_x <= x && x <= rightarrow_x+16)
    {
        if(leftarrow_y <= y && y <= leftarrow_y+16)
        {
            // clicked on an arrow, or the slider
            if(hbarstate == 1)
            {
                //adjust
                int deltax = hbarstartx-x;
                hbarstartx = x;
                //deltax:(available-hbarlen) = dealtaview_x:(totallen-area_width)
                int available = rightarrow_x-(leftarrow_x+16);
                int totallen = view_width;
                
                if(available > hbarlen)
                    view_x -= ((totallen-area_width)*deltax)/(available-hbarlen);
                    
                enforceHardLimits();
                return true;
            }
            
            if(leftarrow_x <= x && x <= leftarrow_x + 16)
            {
                //clicked on left arrow
                scrollLeft();
                leftarrow_state = 1;
                return true;
            }
            
            if(rightarrow_x <= x && x <= rightarrow_x + 16)
            {
                scrollRight();
                rightarrow_state = 1;
                return true;
            }
            else
            {
                //clicked the slider
                if(leftarrow_x+16+hbaroff <= x && x <= leftarrow_x+16+hbaroff+hbarlen)
                {
                    //clicked the bar itself
                    hbarstartx = x;
                    hbarstate = 1;
                    return true;
                }
                else
                {
                    //"teleport"
                    //adjust click by half of length of slider
                    x -= leftarrow_x+16+hbarlen/2;
                    int available = rightarrow_x-(leftarrow_x+16);
                    int totallen = view_width;
                    
                    //x:(available-hbarlen)= view_x:(totallen-area_width)
                    if(available <= hbarlen)
                        view_x=0;
                    else
                        view_x = (x*(totallen-area_width))/(available-hbarlen);
                        
                    enforceHardLimits();
                    return true;
                }
            }
        }
    }
    
    return false;
}
コード例 #17
0
void QuizFrame::init() {
    Preferences& prefs = controller->getPreferences();
    QFont largeFont = prefs.getLargeFont();
    QFont mediumFont = prefs.getMediumFont();
    QFont labelsFont = prefs.getLabelsFont();
    QString firstLang( controller->getQuizFirstLanguage() );
    QString testLang( controller->getQuizTestLanguage() );

    topPanel = new QWidget();
    topPanelLayout = new QHBoxLayout();
    topPanel->setLayout( topPanelLayout );

    topLeftPanel = new QWidget();
    topLeftPanel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) ); 
    topLeftPanelLayout = new QVBoxLayout();
    topLeftPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    topLeftPanel->setLayout( topLeftPanelLayout );
    topPanelLayout->addWidget( topLeftPanel, 1 );

    firstLangPanel = new QWidget();
    firstLangPanelLayout = new QBoxLayout( QBoxLayout::TopToBottom );
    firstLangPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    firstLangPanel->setLayout( firstLangPanelLayout );
    topLeftPanelLayout->addWidget( firstLangPanel );

    testLangPanel = new QWidget();
    testLangPanelLayout = new QBoxLayout( QBoxLayout::TopToBottom );
    testLangPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    testLangPanel->setLayout( testLangPanelLayout );
    topLeftPanelLayout->addWidget( testLangPanel );

    controlPanel = new QWidget();
    controlPanelLayout = new QVBoxLayout();
    controlPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    controlPanel->setLayout( controlPanelLayout );

    answerControlPanel = new QWidget();
    answerControlPanelLayout = new QVBoxLayout();
    answerControlPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    answerControlPanel->setLayout( answerControlPanelLayout );
    controlPanelLayout->addWidget( answerControlPanel );

    revealAllDataButton = new QPushButton( /*tr( "Reveal" )*/ );
    revealAllDataButton->setIcon( QIcon( ZPIXMAP( eye_xpm ) ) );
    revealAllDataButton->setIconSize( QSize( 32, 32 ) );
    revealAllDataButton->setEnabled( false );
    //revealAllDataButton->setToolTip( tr( "Reveal" ) );
    connect( revealAllDataButton, SIGNAL( clicked() ), this, SLOT( reveal() ) );

    rightAnswerButton = new QPushButton( /*tr( "RightAnswer" )*/ );
    rightAnswerButton->setIcon( QIcon( ZPIXMAP( goodAns_xpm ) ) ); 
    rightAnswerButton->setIconSize( QSize( 32, 32 ) );
    rightAnswerButton->setEnabled( false );
    //rightAnswerButton->setToolTip( tr( "RightAnswer" ) );
    connect( rightAnswerButton, SIGNAL( clicked() ), this, SLOT( rightAnswer() ) );

    wrongAnswerButton = new QPushButton( /*tr( "WrongAnswer" )*/ );
    wrongAnswerButton->setIcon( QIcon( ZPIXMAP( badAns_xpm ) ) );
    wrongAnswerButton->setIconSize( QSize( 32, 32 ) );
    wrongAnswerButton->setEnabled( false );
    //wrongAnswerButton->setToolTip( tr( "WrongAnswer" ) );
    connect( wrongAnswerButton, SIGNAL( clicked() ), this, SLOT( wrongAnswer() ) );

    answerControlPanelLayout->addWidget( revealAllDataButton );
    answerControlPanelLayout->addWidget( rightAnswerButton );
    answerControlPanelLayout->addWidget( wrongAnswerButton );

    editionButton = new QPushButton( /*tr( "EditWord" )*/ );
    editionButton->setIcon( QIcon( ZPIXMAP( editTerm_xpm ) ) ); 
    editionButton->setIconSize( QSize( 32, 32 ) );
    editionButton->setMinimumWidth( 100 );
    editionButton->setEnabled( false );
    //editionButton->setToolTip( tr( "EditWord" ) );
    connect( editionButton, SIGNAL( clicked() ), this, SLOT( editCurrentTerm() ) );

    controlPanelLayout->addWidget( answerControlPanel, 1 );
    controlPanelLayout->addWidget( editionButton, 0 );
    
    firstLangTermPanel = new QWidget();
    firstLangTermPanelLayout = new QHBoxLayout();
    firstLangTermPanel->setLayout( firstLangTermPanelLayout );

    firstLangPanelLabel = new QLabel( QApplication::translate( "QObject", firstLang.toLatin1().data() ) );
    firstLangPanelLayout->addWidget( firstLangPanelLabel );
    firstLangPanelLayout->addWidget( firstLangTermPanel );

    firstLangTermLabel = new QLabel( tr( "Word/Expr." ) );

    firstLangTermStack = new QStackedWidget();
    firstLangTermLineEdit = new ScrollableLineEdit();
    firstLangTermLineEdit->setReadOnly( true );
    firstLangTermButton = new QPushButton( tr( "???" ) );
    //firstLangTermButton->setToolTip( tr( "Reveal" ) );
    connect( firstLangTermButton, SIGNAL( clicked() ), this, SLOT( revealFirstLangTerm() ) );  
    firstLangTermStack->addWidget( firstLangTermLineEdit );
    firstLangTermStack->addWidget( firstLangTermButton );

    firstLangTermPanelLayout->addWidget( firstLangTermLabel, 0 );
    firstLangTermPanelLayout->addWidget( firstLangTermStack, 1 );
    
    testLangPanelLabel = new QLabel( QApplication::translate( "QObject", testLang.toLatin1().data() ) );
    testLangPanelLayout->addWidget( testLangPanelLabel );

    testLangTopPanel = new QWidget();
    testLangPanelLayout->addWidget( testLangTopPanel );
    testLangTopPanelLayout = new QHBoxLayout();
    testLangTopPanel->setLayout( testLangTopPanelLayout );

    testLangLabelsPanel = new QWidget();
    testLangLabelsPanelLayout = new QVBoxLayout();
    testLangLabelsPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    testLangLabelsPanel->setLayout( testLangLabelsPanelLayout );

    testLangTermAltLabel = new QLabel( tr( "Alt./Phon." ) );
    testLangLabelsPanelLayout->addWidget( testLangTermAltLabel );
    testLangTermLabel = new QLabel( tr( "Word/Expr." ) );
    testLangLabelsPanelLayout->addWidget( testLangTermLabel );

    testLangFieldsPanel = new QWidget();
    testLangFieldsPanelLayout = new QVBoxLayout();
    testLangFieldsPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    testLangFieldsPanel->setLayout( testLangFieldsPanelLayout );
    testLangTermAltStack = new QStackedWidget();
    testLangFieldsPanelLayout->addWidget( testLangTermAltStack );
    testLangTermAltLineEdit = new ScrollableLineEdit();
    testLangTermAltLineEdit->setReadOnly( true );
    testLangTermAltButton = new QPushButton( tr( "???" ) );
    //testLangTermAltButton->setToolTip( tr( "Reveal" ) );
    connect( testLangTermAltButton, SIGNAL( clicked() ), this, SLOT( revealAltTerm() ) );  
    testLangTermAltStack->addWidget( testLangTermAltLineEdit );
    testLangTermAltStack->addWidget( testLangTermAltButton );

    testLangTermStack = new QStackedWidget();
    testLangFieldsPanelLayout->addWidget( testLangTermStack );
    testLangTermLineEdit = new ScrollableLineEdit();
    testLangTermLineEdit->setReadOnly( true );
    testLangTermButton = new QPushButton( tr( "???" ) );
    //testLangTermButton->setToolTip( tr( "Reveal" ) );
    connect( testLangTermButton, SIGNAL( clicked() ), this, SLOT( revealTestLangTerm() ) );  

    testLangTermStack->addWidget( testLangTermLineEdit );
    testLangTermStack->addWidget( testLangTermButton );

    testLangTopPanelLayout->addWidget( testLangLabelsPanel );
    testLangTopPanelLayout->addWidget( testLangFieldsPanel, 1 );

    commentBox = new QWidget();
    commentBoxLayout = new QVBoxLayout();
    commentBoxLayout->setContentsMargins( 0, 0, 0, 0 );
    commentBox->setLayout( commentBoxLayout );

    commentLabelPanel = new QWidget();
    commentLabelPanelLayout = new QHBoxLayout();
    commentLabelPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    commentLabelPanel->setLayout( commentLabelPanelLayout );
    commentBoxLayout->addWidget( commentLabelPanel );
    commentLabel = new QLabel( tr( "Examples/Comments" ) );
    maximizeCommentButton = new QPushButton();
    maximizeCommentButton->setIcon( QIcon( ZPIXMAP( maximize_xpm ) ) );
    maximizeCommentButton->setIconSize( QSize( 32, 32 ) );
    maximizeCommentButton->setCheckable( true );
    maximizeCommentButton->setMaximumHeight( commentLabel->sizeHint().height() > 24 ? commentLabel->sizeHint().height() : 24 );
    maximizeCommentButton->setMaximumWidth( maximizeCommentButton->maximumHeight() );
    //maximizeCommentButton->setToolTip( tr( "MaximizeComment" ) );
    connect( maximizeCommentButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleMaximizeComment( bool ) ) );
    commentLabelPanelLayout->addWidget( commentLabel );
    commentLabelPanelLayout->addStretch();
    commentLabelPanelLayout->addWidget( maximizeCommentButton );

    commentStack = new QStackedWidget();
    commentBoxLayout->addWidget( commentStack );

    commentMultiLineEdit = new ScrollableMultiLineEdit();
    commentMultiLineEdit->setReadOnly( true );
    commentButton = new QPushButton( tr( "???" ) );
    //commentButton->setToolTip( tr( "Reveal" ) );
    connect( commentButton, SIGNAL( clicked() ), this, SLOT( revealComment() ) );  
    commentStack->addWidget( commentMultiLineEdit );
    commentStack->addWidget( commentButton );

    imageBox = new QWidget();
    imageBoxLayout = new QBoxLayout( QBoxLayout::TopToBottom );
    imageBox->setLayout( imageBoxLayout );

    imageBoxLabel = new QLabel( tr( "Image" ) ); 
    imageBoxLayout->addWidget( imageBoxLabel );

    imageStack = new QStackedWidget();
    imageBoxLayout->addWidget( imageStack );
    imageButton = new QPushButton( tr( "???" ) );
    //imageButton->setToolTip( tr( "Reveal" ) );
    connect( imageButton, SIGNAL( clicked() ), this, SLOT( revealImage() ) );
    image = new QLabel();
    imageStack->addWidget( image );
    imageStack->addWidget( imageButton );

    topPanelLayout->addWidget( imageBox );

    scrollLeftAction = new QAction( this );
    scrollLeftAction->setShortcut( QKeySequence( QKeySequence::MoveToPreviousChar ) );
    connect( scrollLeftAction, SIGNAL( triggered() ), this, SLOT( scrollLeft() ) );
    addAction( scrollLeftAction );

    scrollRightAction = new QAction( this );
    scrollRightAction->setShortcut( QKeySequence( QKeySequence::MoveToNextChar ) );
    connect( scrollRightAction, SIGNAL( triggered() ), this, SLOT( scrollRight() ) );
    addAction( scrollRightAction );

    scrollUpAction = new QAction( this );
    scrollUpAction->setShortcut( QKeySequence( QKeySequence::MoveToPreviousLine ) );
    connect( scrollUpAction, SIGNAL( triggered() ), this, SLOT( scrollUp() ) );
    addAction( scrollUpAction );

    scrollDownAction = new QAction( this );
    scrollDownAction->setShortcut( QKeySequence( QKeySequence::MoveToNextLine ) );
    connect( scrollDownAction, SIGNAL( triggered() ), this, SLOT( scrollDown() ) );
    addAction( scrollDownAction );

    scrollPageUpAction = new QAction( this );
    scrollPageUpAction->setShortcut( QKeySequence( QKeySequence::MoveToPreviousPage ) );
    connect( scrollPageUpAction, SIGNAL( triggered() ), this, SLOT( scrollPageUp() ) );
    addAction( scrollPageUpAction );

    scrollPageDownAction = new QAction( this );
    scrollPageDownAction->setShortcut( QKeySequence( QKeySequence::MoveToNextPage ) );
    connect( scrollPageDownAction, SIGNAL( triggered() ), this, SLOT( scrollPageDown() ) );
    addAction( scrollPageDownAction );

    mainLayout = new QHBoxLayout( this );

    body = new QWidget();
    bodyLayout = new QVBoxLayout();
    bodyLayout->setContentsMargins( 0, 0, 0, 0 );
    body->setLayout( bodyLayout );
 
    bodyLayout->addWidget( topPanel );
    bodyLayout->addWidget( commentBox, 1 );

    bodyWrapper = new QScrollArea();
    bodyWrapper->setWidget( body );

    mainLayout->addWidget( bodyWrapper, 1 );
    mainLayout->addWidget( controlPanel );
    setLayout( mainLayout );
    mainLayout->activate();

    updateFonts();

    setButtonsHidden( prefs.areQuizButtonsHidden() );
}
コード例 #18
0
GcOverlayWidget::GcOverlayWidget(Context *context, QWidget *parent) : QWidget(parent), context(context)
{
    // left / right scroller icon
    static QIcon leftIcon = iconFromPNG(":images/mac/left.png");
    static QIcon rightIcon = iconFromPNG(":images/mac/right.png");

    setContentsMargins(4,0,4,4);
    setAutoFillBackground(false);
    setAttribute(Qt::WA_TranslucentBackground);
    setMouseTracking(true);
    setFocusPolicy(Qt::ClickFocus);
    setMinimumSize(250,200);
    setFocus();
    mode = none;
    initial = true;

    // main layout
    QVBoxLayout *mlayout = new QVBoxLayout(this);
    mlayout->setSpacing(0);
    mlayout->setContentsMargins(1,0,1,1);

    QHBoxLayout *titleLayout = new QHBoxLayout;
    titleLayout->setSpacing(0);
    titleLayout->setContentsMargins(0,0,0,0);
    mlayout->addLayout(titleLayout);

    // scroller buttons
    left = new QToolButton(this);
    left->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    left->setAutoFillBackground(false);
    left->setFixedSize(23,23);
    left->setIcon(leftIcon);
    left->setIconSize(QSize(23,23));
    left->setFocusPolicy(Qt::NoFocus);
    left->hide(); // don't show until we have >1 widgets
    titleLayout->addWidget(left);
    connect(left, SIGNAL(clicked()), this, SLOT(scrollLeft()));

    titleLabel = new GcLabel("No Title Set");
    titleLabel->setAutoFillBackground(false);
    titleLabel->setFixedHeight(23);

    // menu bar in the middle of the buttons
    titleLayout->addStretch();
    titleLayout->addWidget(titleLabel);
    titleLayout->addStretch();

    right = new QToolButton(this);
    right->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    right->setAutoFillBackground(false);
    right->setFixedSize(20,20);
    right->setIcon(rightIcon);
    right->setIconSize(QSize(20,20));
    right->setFocusPolicy(Qt::NoFocus);
    right->hide();
    titleLayout->addWidget(right);
    connect(right, SIGNAL(clicked()), this, SLOT(scrollRight()));

    stack = new QStackedWidget(this);
    stack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    mlayout->addWidget(stack);

    // trap resize / mouse events
    m_infocus = true;
    m_showMenu = false;
    m_isEditing = true;
    installEventFilter(parent);

    connect(context, SIGNAL(configChanged()), this, SLOT(configChanged()));

    // setup colors
    configChanged();
}
コード例 #19
0
ChartBar::ChartBar(Context *context) : QWidget(context->mainWindow), context(context)
{
    // left / right scroller icon
    static QIcon leftIcon = iconFromPNG(":images/mac/left.png");
    static QIcon rightIcon = iconFromPNG(":images/mac/right.png");

    setContentsMargins(0,0,0,0);

    // main layout
    QHBoxLayout *mlayout = new QHBoxLayout(this);
    mlayout->setSpacing(0);
    mlayout->setContentsMargins(0,0,0,0);

    // buttonBar Widget
    buttonBar = new ButtonBar(this);
    buttonBar->setFixedHeight(23);
    buttonBar->setContentsMargins(0,0,0,0);

    QHBoxLayout *vlayout = new QHBoxLayout(buttonBar); 
    vlayout->setSpacing(0);
    vlayout->setContentsMargins(0,0,0,0);

    layout = new QHBoxLayout;
    layout->setSpacing(2);
    layout->setContentsMargins(0,0,0,0);
    vlayout->addLayout(layout);
    vlayout->addStretch();

    // scrollarea
    scrollArea = new QScrollArea(this);
    scrollArea->setAutoFillBackground(false);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameStyle(QFrame::NoFrame);
    scrollArea->setContentsMargins(0,0,0,0);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollArea->setWidget(buttonBar);
    // scroll area turns it on .. we turn it off!
    buttonBar->setAutoFillBackground(false);

    // scroller buttons
    left = new QToolButton(this);
    left->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    left->setAutoFillBackground(false);
    left->setFixedSize(20,20);
    left->setIcon(leftIcon);
    left->setIconSize(QSize(20,20));
    left->setFocusPolicy(Qt::NoFocus);
    mlayout->addWidget(left);
    connect(left, SIGNAL(clicked()), this, SLOT(scrollLeft()));

    // menu bar in the middle of the buttons
    mlayout->addWidget(scrollArea);

    right = new QToolButton(this);
    right->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    right->setAutoFillBackground(false);
    right->setFixedSize(20,20);
    right->setIcon(rightIcon);
    right->setIconSize(QSize(20,20));
    right->setFocusPolicy(Qt::NoFocus);
    mlayout->addWidget(right);
    connect(right, SIGNAL(clicked()), this, SLOT(scrollRight()));

    // spacer to make the menuButton on the right
    QLabel *spacer = new QLabel("", this);
    spacer->setAutoFillBackground(false);
    spacer->setFixedHeight(20);
    spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
    mlayout->addWidget(spacer);

    menuButton = new QToolButton(this);
    menuButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    menuButton->setAutoFillBackground(false);
    menuButton->setFixedSize(20,20);
    menuButton->setIcon(iconFromPNG(":images/sidebar/extra.png"));
    menuButton->setIconSize(QSize(10,10));
    menuButton->setFocusPolicy(Qt::NoFocus);
    mlayout->addWidget(menuButton);
    //connect(p, SIGNAL(clicked()), action, SLOT(trigger()));

    QFontMetrics fs(buttonFont);
#ifdef Q_OS_MAC
    setFixedHeight(fs.height()+7);
    scrollArea->setFixedHeight(fs.height()+7);
    buttonBar->setFixedHeight(fs.height()+7);
#else
    setFixedHeight(fs.height()+4);
    scrollArea->setFixedHeight(fs.height()+4);
    buttonBar->setFixedHeight(fs.height()+4);
#endif

    signalMapper = new QSignalMapper(this); // maps each option
    connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(clicked(int)));

    barMenu = new QMenu("Add");
    chartMenu = barMenu->addMenu(tr("Add Chart"));

    // menu
    connect(menuButton, SIGNAL(clicked()), this, SLOT(menuPopup()));
    connect(chartMenu, SIGNAL(aboutToShow()), this, SLOT(setChartMenu()));
    connect(chartMenu, SIGNAL(triggered(QAction*)), context->mainWindow, SLOT(addChart(QAction*)));

    // trap resize / mouse events
    installEventFilter(this);

    // appearance update
    connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32)));
}
コード例 #20
0
RaptorGraphicsWidget::RaptorGraphicsWidget(QGraphicsItem *parent, const KConfigGroup &appletconfig)
    : QGraphicsWidget(parent),
      d(new Private(this))
{
    setAcceptHoverEvents(true);

    d->model = new Kickoff::ApplicationModel(this);
    d->model->init();
    d->searchModel = new Kickoff::SearchModel();
    d->favoritesModel = new Kickoff::FavoritesModel(this);

    d->view = new RaptorGraphicsView(this);//Initialize the view as first element, some depend on it
    d->view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    d->view->setModel(d->model);

    d->leftScrollButton = new RaptorScrollButton(RaptorScrollButton::Left, this);
//     d->view = new RaptorItemsView();
//     RaptorItemDelegate *delegate = new RaptorItemDelegate();

    d->breadCrumb = new Breadcrumb(d->view, this);
    d->searchLine = new Plasma::LineEdit(this);
    d->favoritesIcon = new Plasma::IconWidget(this);
    d->favoritesIcon->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    d->favoritesIcon->setIcon(KIcon("rating"));
    //d->searchLine->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    d->rightScrollButton = new RaptorScrollButton(RaptorScrollButton::Right, this);
    d->appletConfig = appletconfig;

    QGraphicsLinearLayout *verticalLayout = new QGraphicsLinearLayout(Qt::Vertical);

    QGraphicsLinearLayout *horizontalLayout = new QGraphicsLinearLayout();
    horizontalLayout->addItem(d->breadCrumb);
    horizontalLayout->addStretch();
    horizontalLayout->addItem(d->favoritesIcon);
    horizontalLayout->addItem(d->searchLine);

    verticalLayout->addItem(horizontalLayout);
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout();
    layout->setOrientation(Qt::Horizontal);

    connect(d->leftScrollButton, SIGNAL(clicked()), d->view, SLOT(scrollLeft()));
    layout->addItem(d->leftScrollButton);

    layout->addItem(d->view);

    connect(d->rightScrollButton, SIGNAL(clicked()), d->view, SLOT(scrollRight()));
    layout->addItem(d->rightScrollButton);

    verticalLayout->addItem(layout);

    setLayout(verticalLayout);
// 
//     delegate->setTextColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
// 
//     // let's make the view nicer in the applet
//     d->view->setAttribute(Qt::WA_NoSystemBackground);
//     d->view->viewport()->setAutoFillBackground(true);
//     QPalette p = d->view->viewport()->palette();
//     p.setColor(QPalette::Base, Qt::transparent);
//     d->view->viewport()->setPalette(p);
// 
//     d->view->setModel(d->model);
//     d->view->setItemDelegate(delegate);
// 
//     d->view->hideScrollBars();
// 
//     d->proxy = new QGraphicsProxyWidget(this);
//    d->proxy->setWidget(d->view);

    KConfigGroup config(&d->appletConfig, "PlasmaRunnerManager");
    KConfigGroup conf(&config, "Plugins");

    conf.writeEntry("servicesEnabled", true);

    KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");

    foreach (const KService::Ptr &service, offers) {
        KPluginInfo description(service);
        QString runnerName = description.pluginName();

        if (runnerName != "services")
        {
            conf.writeEntry(QString(runnerName + "Enabled"), false);
        }
    }