コード例 #1
0
ImageLabel::ImageLabel( QWidget *parent ) : QFrame( parent )
{
    setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
    setFrameStyle( QFrame::StyledPanel | QFrame::Plain );
    setLineWidth( 2 );
}
コード例 #2
0
CWizDocumentListView::CWizDocumentListView(CWizExplorerApp& app, QWidget *parent /*= 0*/)
    : QListWidget(parent)
    , m_app(app)
    , m_dbMgr(app.databaseManager())
    , m_tagList(NULL)
{
    setFrameStyle(QFrame::NoFrame);
    setAttribute(Qt::WA_MacShowFocusRect, false);

    connect(this, SIGNAL(itemSelectionChanged()), SLOT(on_itemSelectionChanged()));

    // use custom scrollbar
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_vScroll = new CWizScrollBar(this);
    m_vScroll->syncWith(verticalScrollBar());

    //QScrollAreaKineticScroller *newScroller = new QScrollAreaKineticScroller();
    //newScroller->setWidget(this);
    //m_kinecticScroll = new QsKineticScroller(this);
    //m_kinecticScroll->enableKineticScrollFor(this);

//#ifndef Q_OS_MAC
    // smoothly scroll
    m_vscrollCurrent = 0;
    m_vscrollOldPos = 0;
    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(on_vscroll_valueChanged(int)));
    connect(verticalScrollBar(), SIGNAL(actionTriggered(int)), SLOT(on_vscroll_actionTriggered(int)));
    connect(&m_vscrollTimer, SIGNAL(timeout()), SLOT(on_vscroll_update()));
//#endif //Q_OS_MAC

    setItemDelegate(new CWizDocumentListViewDelegate(this));

    // setup background
    QPalette pal = palette();
    pal.setColor(QPalette::Base, QColor(247,247,247));
    setPalette(pal);

    setStyle(::WizGetStyle(m_app.userSettings().skin()));

    connect(&m_dbMgr, SIGNAL(tagCreated(const WIZTAGDATA&)), \
            SLOT(on_tag_created(const WIZTAGDATA&)));

    connect(&m_dbMgr, SIGNAL(tagModified(const WIZTAGDATA&, const WIZTAGDATA&)), \
            SLOT(on_tag_modified(const WIZTAGDATA&, const WIZTAGDATA&)));

    connect(&m_dbMgr, SIGNAL(documentCreated(const WIZDOCUMENTDATA&)), \
            SLOT(on_document_created(const WIZDOCUMENTDATA&)));

    connect(&m_dbMgr, SIGNAL(documentModified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)), \
            SLOT(on_document_modified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)));

    connect(&m_dbMgr, SIGNAL(documentDeleted(const WIZDOCUMENTDATA&)),
            SLOT(on_document_deleted(const WIZDOCUMENTDATA&)));

    // message
    connect(&m_dbMgr.db(), SIGNAL(messageModified(const WIZMESSAGEDATA&, const WIZMESSAGEDATA&)),
            SLOT(on_message_modified(const WIZMESSAGEDATA&, const WIZMESSAGEDATA&)));

    connect(&m_dbMgr.db(), SIGNAL(messageDeleted(const WIZMESSAGEDATA&)),
            SLOT(on_message_deleted(const WIZMESSAGEDATA&)));


    // thumb cache
    m_thumbCache = new CWizThumbIndexCache(app);
    connect(m_thumbCache, SIGNAL(loaded(const WIZABSTRACT&)),
            SLOT(on_document_abstractLoaded(const WIZABSTRACT&)));

    QThread *thread = new QThread();
    m_thumbCache->moveToThread(thread);
    thread->start();

    // avatar downloader
    m_avatarDownloader = new CWizUserAvatarDownloaderHost(m_dbMgr.db().GetAvatarPath(), this);
    connect(m_avatarDownloader, SIGNAL(downloaded(const QString&)),
            SLOT(on_userAvatar_downloaded(const QString&)));

    setDragDropMode(QAbstractItemView::DragDrop);
    setDragEnabled(true);
    viewport()->setAcceptDrops(true);

    setSelectionMode(QAbstractItemView::ExtendedSelection);

    // message context menu
    m_menuMessage = new QMenu(this);
    m_menuMessage->addAction(WIZACTION_LIST_MESSAGE_MARK_READ, this,
                             SLOT(on_action_message_mark_read()));
    m_menuMessage->addAction(WIZACTION_LIST_MESSAGE_DELETE, this,
                             SLOT(on_action_message_delete()));

    // document context menu
    m_menuDocument = new QMenu(this);
    m_menuDocument->addAction(WIZACTION_LIST_TAGS, this,
                              SLOT(on_action_selectTags()));
    m_menuDocument->addSeparator();
    QAction* actionDeleteDoc = m_menuDocument->addAction(WIZACTION_LIST_DELETE,
                                                         this, SLOT(on_action_deleteDocument()), QKeySequence::Delete);
    QAction* actionMoveDoc = m_menuDocument->addAction(WIZACTION_LIST_MOVE_DOCUMENT,
                                                       this, SLOT(on_action_moveDocument()), QKeySequence("Ctrl+Shift+M"));
    QAction* actionCopyDoc = m_menuDocument->addAction(WIZACTION_LIST_COPY_DOCUMENT,
                                                       this, SLOT(on_action_copyDocument()), QKeySequence("Ctrl+Shift+C"));

    // not implement, hide currently.
    actionCopyDoc->setVisible(false);

    // Add to widget's actions list
    addAction(actionDeleteDoc);
    addAction(actionMoveDoc);
    addAction(actionCopyDoc);
    actionDeleteDoc->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    actionMoveDoc->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    //actionCopyDoc->setShortcutContext(Qt::WidgetWithChildrenShortcut);

    //m_actionEncryptDocument = new QAction(tr("Encrypt Document"), m_menu);
    //connect(m_actionEncryptDocument, SIGNAL(triggered()), SLOT(on_action_encryptDocument()));
    //m_menu->addAction(m_actionEncryptDocument);
}
コード例 #3
0
ファイル: curvdemo1.cpp プロジェクト: elcuco/data_mining_demo
MainWin::MainWin() 
{
    int i;

    xMap.setScaleInterval(-0.5, 10.5);
    yMap.setScaleInterval(-1.1, 1.1);

    //
    //  Frame style
    //  
    setFrameStyle(QFrame::Box|QFrame::Raised);
    setLineWidth(2);
    setMidLineWidth(3);

    //
    // Calculate values
    //
    for(i=0; i<Size;i++)
    {   xval[i] = double(i) * 10.0 / double(Size - 1);
        yval[i] = sin(xval[i]) * cos(2.0 * xval[i]);
    }
    
    //
    //  define curve styles
    // 
    QwtSymbol sym;
    i = 0;

    sym.setStyle(QwtSymbol::Cross);
    sym.setPen(QColor(Qt::black));
    sym.setSize(5);
    crv[i].setSymbol(sym);
    crv[i].setPen(QColor(Qt::darkGreen));
    crv[i].setStyle(QwtPlotCurve::Lines);
    crv[i].setCurveAttribute(QwtPlotCurve::Fitted);
    i++;

    sym.setStyle(QwtSymbol::Ellipse);
    sym.setPen(QColor(Qt::blue));
    sym.setBrush(QColor(Qt::yellow));
    sym.setSize(5);
    crv[i].setSymbol(sym);
    crv[i].setPen(QColor(Qt::red));
    crv[i].setStyle(QwtPlotCurve::Sticks);
    i++;

    crv[i].setPen(QColor(Qt::darkBlue));
    crv[i].setStyle(QwtPlotCurve::Lines);
    i++;

#if QT_VERSION >= 0x040000
    crv[i].setPen(QColor(Qt::darkBlue));
    crv[i].setStyle(QwtPlotCurve::Lines);
    crv[i].setRenderHint(QwtPlotItem::RenderAntialiased);
    i++;
#endif


    crv[i].setPen(QColor(Qt::darkCyan));
    crv[i].setStyle(QwtPlotCurve::Steps);
    i++;

    sym.setStyle(QwtSymbol::XCross);
    sym.setPen(QColor(Qt::darkMagenta));
    crv[i].setSymbol(sym);
    crv[i].setStyle(QwtPlotCurve::NoCurve);
    i++;


    //
    // attach data
    //
    for(i=0;i<CurvCnt;i++)
        crv[i].setRawData(xval,yval,Size);
}
コード例 #4
0
MainWin::MainWin()
{
    int i;

    xMap.setScaleInterval(-0.5, 10.5);
    yMap.setScaleInterval(-1.1, 1.1);

    //
    //  Frame style
    //
    setFrameStyle(QFrame::Box|QFrame::Raised);
    setLineWidth(2);
    setMidLineWidth(3);

    //
    // Calculate values
    //
    for(i=0; i<Size;i++)
    {
        xval[i] = double(i) * 10.0 / double(Size - 1);
        yval[i] = qSin(xval[i]) * qCos(2.0 * xval[i]);
    }

    //
    //  define curve styles
    //
    i = 0;

    d_curves[i].setSymbol(new QwtSymbol(QwtSymbol::Cross, Qt::NoBrush,
        QPen(Qt::black), QSize(5, 5) ) );
    d_curves[i].setPen(QColor(Qt::darkGreen));
    d_curves[i].setStyle(QwtPlotCurve::Lines);
    d_curves[i].setCurveAttribute(QwtPlotCurve::Fitted);
    i++;

    d_curves[i].setSymbol(new QwtSymbol(QwtSymbol::Ellipse, Qt::yellow,
        QPen(Qt::blue), QSize(5, 5) ) );
    d_curves[i].setPen(QColor(Qt::red));
    d_curves[i].setStyle(QwtPlotCurve::Sticks);
    i++;

    d_curves[i].setPen(QColor(Qt::darkBlue));
    d_curves[i].setStyle(QwtPlotCurve::Lines);
    i++;

    d_curves[i].setPen(QColor(Qt::darkBlue));
    d_curves[i].setStyle(QwtPlotCurve::Lines);
    d_curves[i].setRenderHint(QwtPlotItem::RenderAntialiased);
    i++;

    d_curves[i].setPen(QColor(Qt::darkCyan));
    d_curves[i].setStyle(QwtPlotCurve::Steps);
    i++;

    d_curves[i].setSymbol(new QwtSymbol(QwtSymbol::XCross, Qt::NoBrush,
        QPen(Qt::darkMagenta), QSize(5, 5) ) );
    d_curves[i].setStyle(QwtPlotCurve::NoCurve);
    i++;


    //
    // attach data
    //
    for(i=0;i<CurvCnt;i++)
        d_curves[i].setRawSamples(xval, yval, Size);
}
コード例 #5
0
ファイル: brainplot.cpp プロジェクト: cogitoergobum/eeg
BrainPlot::BrainPlot(QWidget *parent, int nChannels, int Length, int Amplitude):
    QwtPlot( parent ),
    d_curves( nChannels ),
    d_zeros( nChannels )
{
    /*Set some attributes*/
    minusExpectedAmplitude = -Amplitude;
    plotLength = Length;
    this->nChannels = nChannels;

    /*Start sample counter*/
    sample = 0;

    /*Painter*/
    d_directPainter = new QwtPlotDirectPainter( this );
    if ( QwtPainter::isX11GraphicsSystem() )
    {
#if QT_VERSION < 0x050000
        canvas()->setAttribute( Qt::WA_PaintOutsidePaintEvent, true );
#endif
        canvas()->setAttribute( Qt::WA_PaintOnScreen, true );
    }

    /*Activates the legend for channel tracking*/
    QwtLegend *legend = new QwtLegend;
    legend->setDefaultItemMode( QwtLegendData::ReadOnly);
    insertLegend( legend, QwtPlot::LeftLegend );

    /*Instantiate the reference lines and the data curves for each channel*/
    int Hfactor = 360/(nChannels+1);//different colors for each curve
    char name[15];

    for(int c = 0; c < nChannels; c++) {
        /*Curve*/
        sprintf(name, "Channel %d", c+1);
        d_curves[c] = new QwtPlotCurve( name);
        d_curves[c]->setData( new CurveData(plotLength,
                                            minusExpectedAmplitude*(2*c+1)) );
        d_curves[c]->setPen( QColor::fromHsv ( Hfactor*c, 255, 255));
        d_curves[c]->setStyle( QwtPlotCurve::Lines );
        d_curves[c]->setSymbol( new QwtSymbol( QwtSymbol::NoSymbol));
        d_curves[c]->attach( this );

        /*Reference line*/
        d_zeros[c] = new QwtPlotCurve;
        d_zeros[c]->setData( new CurveData() );
        d_zeros[c]->setPen( QColor::fromHsv ( Hfactor*c, 255, 140));
        d_zeros[c]->setStyle( QwtPlotCurve::Lines );
        d_zeros[c]->setSymbol( new QwtSymbol( QwtSymbol::NoSymbol));
        d_zeros[c]->setItemAttribute(QwtPlotItem::Legend, false);
        d_zeros[c]->attach( this );

        /*Draw reference lines*/
        CurveData *data = static_cast<CurveData *>( d_zeros[c]->data() );
        data->append(QPointF(0, minusExpectedAmplitude*(2*c+1)));
        data->append(QPointF(plotLength, minusExpectedAmplitude*(2*c+1)));
        d_directPainter->drawSeries( d_zeros[c], 0, 1);
    }

    /*Sweeping line*/
    d_sweep = new QwtPlotCurve;
    d_sweep->setData( new CurveData() );
    d_sweep->setPen( Qt::black, plotLength/100, Qt::SolidLine);
    d_sweep->setStyle( QwtPlotCurve::Lines );
    d_sweep->setSymbol( new QwtSymbol( QwtSymbol::NoSymbol));
    d_sweep->setItemAttribute(QwtPlotItem::Legend, false);
    d_sweep->attach( this );

    CurveData *data = static_cast<CurveData *>( d_sweep->data() );
    data->append(QPointF(0, plotLength));
    data->append(QPointF(0, 2*nChannels*minusExpectedAmplitude));

    /*Axis*/
    setAxisScale( xBottom, 0, plotLength );
    setAxisScale( yLeft, 2*nChannels*minusExpectedAmplitude, 0 );

    enableAxis(xBottom, false);
    enableAxis(yLeft, false);

    /*Frame*/
    setFrameStyle( QFrame::NoFrame );
    setLineWidth( 0 );

    /*Canvas*/
    plotLayout()->setAlignCanvasToScales( true );
    plotLayout()->setCanvasMargin(100, QwtPlot::xBottom);
    plotLayout()->setCanvasMargin(100, QwtPlot::xTop);
    setCanvasBackground( Qt::black );

    /*Grid*/
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->setMajorPen( Qt::gray, 0, Qt::DotLine );
    grid->setMinorPen( Qt::gray, 0, Qt::DotLine );
    grid->enableYMin(true);
    grid->attach( this );

    /*Optimizaion for real-time data collecting*/
    setAutoReplot( false );

    /*Show*/
    replot();
}
コード例 #6
0
ファイル: logedit.cpp プロジェクト: birefringence/kstars
LogEdit::LogEdit( QWidget *parent ) : KTextEdit( parent )
{
    setFrameStyle( QFrame::StyledPanel );
    setFrameShadow( QFrame::Plain );
    setLineWidth( 4 );
}
コード例 #7
0
ファイル: view.cpp プロジェクト: AlexSoehn/qt-base-deb
View::View(const QString &name, QWidget *parent)
    : QFrame(parent)
{
    setFrameStyle(Sunken | StyledPanel);
    graphicsView = new GraphicsView(this);
    graphicsView->setRenderHint(QPainter::Antialiasing, false);
    graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);

    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
    zoomInIcon->setIconSize(iconSize);
    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
    zoomOutIcon->setIconSize(iconSize);
    zoomSlider = new QSlider;
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(500);
    zoomSlider->setValue(250);
    zoomSlider->setTickPosition(QSlider::TicksRight);

    // Zoom slider layout
    QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
    zoomSliderLayout->addWidget(zoomInIcon);
    zoomSliderLayout->addWidget(zoomSlider);
    zoomSliderLayout->addWidget(zoomOutIcon);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/rotateright.png"));
    rotateRightIcon->setIconSize(iconSize);
    rotateSlider = new QSlider;
    rotateSlider->setOrientation(Qt::Horizontal);
    rotateSlider->setMinimum(-360);
    rotateSlider->setMaximum(360);
    rotateSlider->setValue(0);
    rotateSlider->setTickPosition(QSlider::TicksBelow);

    // Rotate slider layout
    QHBoxLayout *rotateSliderLayout = new QHBoxLayout;
    rotateSliderLayout->addWidget(rotateLeftIcon);
    rotateSliderLayout->addWidget(rotateSlider);
    rotateSliderLayout->addWidget(rotateRightIcon);

    resetButton = new QToolButton;
    resetButton->setText(tr("0"));
    resetButton->setEnabled(false);

    // Label layout
    QHBoxLayout *labelLayout = new QHBoxLayout;
    label = new QLabel(name);
    label2 = new QLabel(tr("Pointer Mode"));
    selectModeButton = new QToolButton;
    selectModeButton->setText(tr("Select"));
    selectModeButton->setCheckable(true);
    selectModeButton->setChecked(true);
    dragModeButton = new QToolButton;
    dragModeButton->setText(tr("Drag"));
    dragModeButton->setCheckable(true);
    dragModeButton->setChecked(false);
    antialiasButton = new QToolButton;
    antialiasButton->setText(tr("Antialiasing"));
    antialiasButton->setCheckable(true);
    antialiasButton->setChecked(false);
    openGlButton = new QToolButton;
    openGlButton->setText(tr("OpenGL"));
    openGlButton->setCheckable(true);
#ifndef QT_NO_OPENGL
    openGlButton->setEnabled(QGLFormat::hasOpenGL());
#else
    openGlButton->setEnabled(false);
#endif
    printButton = new QToolButton;
    printButton->setIcon(QIcon(QPixmap(":/fileprint.png")));

    QButtonGroup *pointerModeGroup = new QButtonGroup;
    pointerModeGroup->setExclusive(true);
    pointerModeGroup->addButton(selectModeButton);
    pointerModeGroup->addButton(dragModeButton);

    labelLayout->addWidget(label);
    labelLayout->addStretch();
    labelLayout->addWidget(label2);
    labelLayout->addWidget(selectModeButton);
    labelLayout->addWidget(dragModeButton);
    labelLayout->addStretch();
    labelLayout->addWidget(antialiasButton);
    labelLayout->addWidget(openGlButton);
    labelLayout->addWidget(printButton);

    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(graphicsView, 1, 0);
    topLayout->addLayout(zoomSliderLayout, 1, 1);
    topLayout->addLayout(rotateSliderLayout, 2, 0);
    topLayout->addWidget(resetButton, 2, 1);
    setLayout(topLayout);

    connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(selectModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    connect(dragModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
    connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    connect(printButton, SIGNAL(clicked()), this, SLOT(print()));

    setupMatrix();
}
コード例 #8
0
ファイル: qprogressbar.cpp プロジェクト: aroraujjwal/qt3
void QProgressBar::initFrame()
{
    setFrameStyle(QFrame::NoFrame);
}
コード例 #9
0
ファイル: popupMessage.cpp プロジェクト: adaptee/qterm-hack
PopupMessage::PopupMessage( QWidget *parent, QWidget *anchor, int timeout)
                : OverlayWidget( parent, anchor)
                , m_anchor( anchor )
                , m_parent( parent )
                , m_maskEffect( Slide )
                , m_dissolveSize( 0 )
                , m_dissolveDelta( -1 )
                , m_offset( 0 )
                , m_counter( 0 )
                , m_stage( 1 )
                , m_timeout( timeout )
                , m_showCounter( true )
{
    setFrameStyle( QFrame::Panel | QFrame::Raised );
    setFrameShape( QFrame::StyledPanel );
//     overrideWindowFlags( Qt::WX11BypassWM );

    QHBoxLayout *hbox;
    QLabel *label;
    QLabel *alabel;
    //KActiveLabel *alabel;

	m_layout = new QVBoxLayout( this );//, 9 /*margin*/, 6 /*spacing*/ );
	m_layout->setMargin(9);
	m_layout->setSpacing(6);

	hbox = new QHBoxLayout; //( m_layout, 12 );
	hbox->setMargin(12);
	
	m_layout->addLayout(hbox);

    hbox->addWidget( m_countdownFrame = new QFrame( this ));//, "counterVisual" ) );
    m_countdownFrame->setObjectName( "counterVisual" );
    m_countdownFrame->setFixedWidth( fontMetrics().width( "X" ) );
    m_countdownFrame->setFrameStyle( QFrame::Plain | QFrame::Box );
    QPalette tmp_palette;
    tmp_palette.setColor(m_countdownFrame->foregroundRole(), palette().color(QPalette::Window).dark());
    m_countdownFrame->setPalette(tmp_palette);
//     m_countdownFrame->setPaletteForegroundColor( paletteBackgroundColor().dark() );

    label = new QLabel( this );//, "image" );
    label->setObjectName("image");
    hbox->addWidget( label );
    label->hide();

    alabel = new QLabel( "Details of the tasks: ", this );//, "label");
    alabel->setObjectName("label");
    //alabel = new KActiveLabel( this, "label" );
    //alabel->setTextFormat( Qt::RichText );
    alabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );

    hbox->addWidget( alabel );

	hbox = new QHBoxLayout;
	
	m_layout->addLayout(hbox);

    hbox->addItem( new QSpacerItem( 4, 4, QSizePolicy::Expanding, QSizePolicy::Preferred ) );
    //FIXME: add icon
    QPushButton * tmp_button = new QPushButton( "Close", this );
    tmp_button->setObjectName( "closeButton" );
    hbox->addWidget( tmp_button );//, "closeButton" ) );

    connect( findChild<QPushButton *>( "closeButton" ), SIGNAL(clicked()), SLOT(close()) );
}
コード例 #10
0
ファイル: deckmon.cpp プロジェクト: stgabmp/Rivendell
DeckMon::DeckMon(QString station,unsigned channel,
		 QWidget *parent,const char *name)
  : QFrame(parent,name)
{
  mon_station=station;
  mon_channel=channel;

  setFrameStyle(Box|Raised);
  setLineWidth(1);
  setMidLineWidth(2);

  //
  // Generate Fonts
  //
  QFont small_font=QFont("Helvetica",6,QFont::Bold);
  small_font.setPixelSize(6);
  QFont label_font("Helvetica",12,QFont::Normal);
  label_font.setPixelSize(12);

  //
  // Station/Channel
  //
  mon_station_label=new QLabel(this,"mon_station_label");
  mon_station_label->setFont(label_font);
  if((mon_channel>0)&&(mon_channel<(MAX_DECKS+1))) {
    mon_station_label->
      setText(QString().
	      sprintf("%s : %uR",(const char *)mon_station,mon_channel));
  }
  if((mon_channel>128)&&(mon_channel<(MAX_DECKS+129))) {
    mon_station_label->
      setText(QString().
	      sprintf("%s : %uP",(const char *)mon_station,mon_channel-128));
  }

  //
  // Monitor Button
  //
  mon_monitor_button=new QPushButton(this,"mon_monitor_button");
  mon_monitor_button->setFont(small_font);
  mon_monitor_button->setText(tr("MON"));
  mon_monitor_palette=new QPalette(QColor(BUTTON_MONITOR_FLASHING_COLOR),
				   backgroundColor());
  if((mon_channel>128)&&(mon_channel<(MAX_DECKS+129))) {
    mon_monitor_button->hide();
  }
  connect(mon_monitor_button,SIGNAL(clicked()),
	  this,SLOT(monitorButtonData()));

  //
  // Abort Button
  //
  mon_abort_button=new QPushButton(this,"mon_abort_button");
  mon_abort_button->setFont(small_font);
  mon_abort_button->setText(tr("ABORT"));
  mon_abort_button->setDisabled(true);
  connect(mon_abort_button,SIGNAL(clicked()),this,SLOT(abortButtonData()));

  //
  // Cut
  //
  mon_cut_label=new QLabel(this,"mon_cut_label");
  mon_cut_label->setFont(label_font);

  //
  // Status
  //
  mon_status_label=new QLabel(tr("OFFLINE"),this,"mon_status_label");
  mon_status_label->setFont(label_font);

  //
  // Audio Meter
  //
  mon_left_meter=new RDPlayMeter(RDSegMeter::Right,this,"mon_left_meter");
  mon_left_meter->setMode(RDSegMeter::Peak);
  mon_left_meter->setRange(-4600,-800);
  mon_left_meter->setHighThreshold(-1600);
  mon_left_meter->setClipThreshold(-1100);
  mon_left_meter->setLabel(tr("L"));
  mon_right_meter=new RDPlayMeter(RDSegMeter::Right,this,"mon_right_meter");
  mon_right_meter->setMode(RDSegMeter::Peak);
  mon_right_meter->setRange(-4600,-800);
  mon_right_meter->setHighThreshold(-1600);
  mon_right_meter->setClipThreshold(-1100);
  mon_right_meter->setLabel(tr("R"));
}
コード例 #11
0
TransferFunctionManager::TransferFunctionManager(QWidget *parent) :
  QFrame(parent)
{
  setFrameStyle(QFrame::StyledPanel);
  setFrameShadow(QFrame::Plain);

  m_tfContainer = NULL;

  m_buttonGroup = new QGroupBox();

  QPushButton *newTF = new QPushButton("New");
  QPushButton *refreshTF = new QPushButton("Refresh");
  QPushButton *removeTF = new QPushButton("Remove");

  QHBoxLayout *hbox = new QHBoxLayout();
  hbox->addWidget(newTF);
  hbox->addWidget(refreshTF);
  hbox->addWidget(removeTF);
  hbox->addStretch(1);

  m_buttonGroup->setLayout(hbox);


  connect(newTF, SIGNAL(clicked()),
	  this, SLOT(addNewTransferFunction()));

  connect(refreshTF, SIGNAL(clicked()),
	  this, SLOT(refreshTransferFunction()));

  connect(removeTF, SIGNAL(clicked()),
	  this, SLOT(removeTransferFunction()));


  m_tableWidget = new QTableWidget();
  m_tableWidget->horizontalHeader()->setSectionsMovable(true);
  m_tableWidget->horizontalHeader()->setSectionsClickable(true);
  m_tableWidget->verticalHeader()->hide();
  m_tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
  m_tableWidget->setShowGrid(false);
  m_tableWidget->setAlternatingRowColors(true);
  m_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
  m_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
  QString str;
  str = QString("QTableWidget {"					\
		"selection-background-color: qlineargradient("		\
		"x1:0, y1:0, x2:0, y2:1, "				\
		"stop:0 darkgray,  stop:0.4 lightgray, "		\
		"stop:0.6 lightgray, stop:1 darkgray);"			\
		"}");
  m_tableWidget->setStyleSheet(str);

  modifyTableWidget();


  QVBoxLayout *vbox = new QVBoxLayout();
  vbox->addWidget(m_buttonGroup);
  vbox->addWidget(m_tableWidget);

  setLayout(vbox);

  connect(m_tableWidget->horizontalHeader(), SIGNAL(sectionClicked(int)),
	  this, SLOT(headerClicked(int)));

  connect(m_tableWidget, SIGNAL(cellClicked(int, int)),
	  this, SLOT(cellClicked(int, int)));

  connect(m_tableWidget, SIGNAL(cellChanged(int, int)),
	  this, SLOT(cellChanged(int, int)));

  setMinimumSize(100, 50);
}
コード例 #12
0
ファイル: cardinfowidget.cpp プロジェクト: Arkham/Cockatrice
CardInfoWidget::CardInfoWidget(ResizeMode _mode, const QString &cardName, QWidget *parent, Qt::WindowFlags flags)
	: QFrame(parent, flags)
	, pixmapWidth(0)
	, aspectRatio((qreal) CARD_HEIGHT / (qreal) CARD_WIDTH)
	, minimized(settingsCache->getCardInfoMinimized()) // Initialize the cardinfo view status from cache.
	, mode(_mode)
	, info(0)
{
	if (mode == ModeGameTab) {
		// Create indexed list of status views for card.
		const QStringList cardInfoStatus = QStringList() << tr("Show card only") << tr("Show text only") << tr("Show full info");
		
		// Create droplist for cardinfo view selection, and set right current index.
		dropList = new QComboBox();
		dropList->addItems(cardInfoStatus);
		dropList->setCurrentIndex(minimized);
		connect(dropList, SIGNAL(currentIndexChanged(int)), this, SLOT(minimizeClicked(int)));
	}

	cardPicture = new QLabel;
	cardPicture->setAlignment(Qt::AlignCenter);

	nameLabel1 = new QLabel;
	nameLabel2 = new QLabel;
	nameLabel2->setWordWrap(true);
	manacostLabel1 = new QLabel;
	manacostLabel2 = new QLabel;
	manacostLabel2->setWordWrap(true);
	cardtypeLabel1 = new QLabel;
	cardtypeLabel2 = new QLabel;
	cardtypeLabel2->setWordWrap(true);
	powtoughLabel1 = new QLabel;
	powtoughLabel2 = new QLabel;
	loyaltyLabel1 = new QLabel;
	loyaltyLabel2 = new QLabel;

	textLabel = new QTextEdit();
	textLabel->setReadOnly(true);

	QGridLayout *grid = new QGridLayout(this);
	int row = 0;
	if (mode == ModeGameTab)
		grid->addWidget(dropList, row++, 1, 1, 1, Qt::AlignRight);
	grid->addWidget(cardPicture, row++, 0, 1, 2);
	grid->addWidget(nameLabel1, row, 0);
	grid->addWidget(nameLabel2, row++, 1);
	grid->addWidget(manacostLabel1, row, 0);
	grid->addWidget(manacostLabel2, row++, 1);
	grid->addWidget(cardtypeLabel1, row, 0);
	grid->addWidget(cardtypeLabel2, row++, 1);
	grid->addWidget(powtoughLabel1, row, 0);
	grid->addWidget(powtoughLabel2, row++, 1);
	grid->addWidget(loyaltyLabel1, row, 0);
	grid->addWidget(loyaltyLabel2, row++, 1);
	grid->addWidget(textLabel, row, 0, -1, 2);
	grid->setRowStretch(row, 1);
	grid->setColumnStretch(1, 1);

	retranslateUi();
	setFrameStyle(QFrame::Panel | QFrame::Raised);
	if (mode == ModeGameTab) {
		textLabel->setMinimumHeight(100);
		setFixedWidth(sizeHint().width());
	} else if (mode == ModePopUp) {
		QDesktopWidget desktopWidget;
		pixmapWidth = desktopWidget.screenGeometry().height() / 3 / aspectRatio;
		setFixedWidth(pixmapWidth + 150);
	} else
		setFixedWidth(250);
	
	setCard(db->getCard(cardName));
	setMinimized(settingsCache->getCardInfoMinimized());
}
コード例 #13
0
void QFrame::setFrameShadow(QFrame::Shadow s)
{
    Q_D(QFrame);
    setFrameStyle((d->frameStyle & Shape_Mask) | s);
}
コード例 #14
0
ファイル: eventwidget.cpp プロジェクト: kthxbyte/KDE1-Linaro
/* 
 * EventWidget -- main widget for displaying events
 */
EventWidget::EventWidget( KDPEvent *_event, CalObject *_calendar,
			  QDate _date, QWidget *parent, char *_name )
  : QFrame( parent, _name )
{
  widgetEvent = _event;
  widgetDate = _date;
  calendar = _calendar;
  ASSERT(widgetEvent);

  // set up widgets.
  useHandle = TRUE;
  handleFrame = new QFrame(this, "handleFrame");
  handleFrame->setFrameStyle(Panel | Sunken);
  handleFrame->setLineWidth(2);
  handleFrame->setFixedWidth(HANDLESIZE);
  handleFrame->setMouseTracking(TRUE);
  handleFrame->setFocusProxy(this);

  textBox = new KTextBox(this, "textBox");
  textBox->setFrameStyle(NoFrame);
  textBox->setMouseTracking(TRUE);

  useIcons = TRUE;
  iconBox = new EWIconBoxFrame(this, "iconBox");
  iconBox->setFrameStyle(NoFrame);
  iconBox->setMinimumWidth(2*PMMARGIN+MAXPMSIZE);
  iconBox->setMouseTracking(TRUE);
  iconBox->setFocusProxy(this);

  // we filter ALL events.
  setFrameStyle(Box | Plain);
  setLineWidth(1);
  setFocusPolicy(ClickFocus);
  setMouseTracking(TRUE);
  installEventFilter(this);
  handleFrame->installEventFilter(this);
  textBox->installEventFilter(this);
  iconBox->installEventFilter(this);

  // set flags
  setState(NoState);
  // what type of resizing is going on
  ResizeStatus = 0;
  
  widgetSelected = FALSE;

  // RMB popup menu
  rmbPopup = new QPopupMenu();
  rmbPopup->insertItem(i18n("&Edit"));
  QPixmap pm = Icon("delete.xpm");
  rmbPopup->insertItem(pm, i18n("&Delete"));
  pm = Icon("bell.xpm");
  rmbPopup->insertItem(pm, i18n("Toggle Alarm"));
  connect(rmbPopup, SIGNAL(activated(int)), 
	  SLOT(popupSlot(int)));

  updateConfig();

  setSelected(FALSE);

  // set text
  if (!widgetEvent->getSummary().isEmpty())
    setText(widgetEvent->getSummary());

  if (widgetEvent->isReadOnly()) {
    setEnabled(FALSE);
    iconBox->setEnabled(FALSE);
    textBox->setEnabled(FALSE);
    setBackgroundColor(palette().disabled().base());
  }
}
コード例 #15
0
ファイル: vcslider.cpp プロジェクト: roberts-sandbox/qlcplus
VCSlider::VCSlider(QWidget* parent, Doc* doc) : VCWidget(parent, doc)
{
    /* Set the class name "VCSlider" as the object name as well */
    setObjectName(VCSlider::staticMetaObject.className());

    m_hbox = NULL;
    m_topLabel = NULL;
    m_slider = NULL;
    m_bottomLabel = NULL;
    m_tapButton = NULL;

    m_valueDisplayStyle = ExactValue;

    m_levelLowLimit = 0;
    m_levelHighLimit = UCHAR_MAX;

    m_levelValue = 0;
    m_levelValueChanged = false;

    m_playbackFunction = Function::invalidId();
    m_playbackValue = 0;
    m_playbackValueChanged = false;

    m_time = NULL;

    setCaption(QString());
    setFrameStyle(KVCFrameStyleSunken);

    /* Main VBox */
    new QVBoxLayout(this);

    /* Top label */
    m_topLabel = new QLabel(this);
    layout()->addWidget(m_topLabel);
    m_topLabel->setAlignment(Qt::AlignHCenter);

    /* Slider's HBox |stretch|slider|stretch| */
    m_hbox = new QHBoxLayout();
    layout()->addItem(m_hbox);

    /* Put stretchable space before the slider (to its left side) */
    m_hbox->addStretch();

    /* The slider */
    m_slider = new QSlider(this);
    m_slider->setStyle(AppUtil::saneStyle());
    m_hbox->addWidget(m_slider);
    m_slider->setRange(0, 255);
    m_slider->setPageStep(1);
    m_slider->setInvertedAppearance(false);
    connect(m_slider, SIGNAL(valueChanged(int)),
            this, SLOT(slotSliderMoved(int)));
    m_externalMovement = false;

    /* Put stretchable space after the slider (to its right side) */
    m_hbox->addStretch();

    /* Tap button */
    m_tapButton = new QPushButton(this);
    layout()->addWidget(m_tapButton);
    connect(m_tapButton, SIGNAL(clicked()),
            this, SLOT(slotTapButtonClicked()));
    m_time = new QTime();

    /* Bottom label */
    m_bottomLabel = new QLabel(this);
    layout()->addWidget(m_bottomLabel);
    m_bottomLabel->setAlignment(Qt::AlignCenter);
    m_bottomLabel->hide();

    setMinimumSize(20, 20);
    resize(VCSlider::defaultSize);

    /* Initialize to playback mode by default */
    setInvertedAppearance(false);
    setSliderMode(Playback);

    /* Update the slider according to current mode */
    slotModeChanged(mode());

    /* Listen to fixture removals so that LevelChannels can be removed when
       they no longer point to an existing fixture->channel */
    connect(m_doc, SIGNAL(fixtureRemoved(quint32)),
            this, SLOT(slotFixtureRemoved(quint32)));
}
コード例 #16
0
ファイル: eventwidget.cpp プロジェクト: kthxbyte/KDE1-Linaro
/*
 * KTextBox Widget
 */
KTextBox::KTextBox( QWidget *parent, char *name )
  : QMultiLineEdit( parent, name )
{
  clearTableFlags( Tbl_autoScrollBars );
  setFrameStyle( NoFrame );
}
コード例 #17
0
SelectableTextEditorWidget::SelectableTextEditorWidget(Core::Id id, QWidget *parent)
    : TextEditorWidget(parent)
{
    setFrameStyle(QFrame::NoFrame);
    setupFallBackEditor(id);
}
コード例 #18
0
ファイル: vcslider.cpp プロジェクト: shimaore/qlcplus
VCSlider::VCSlider(QWidget* parent, Doc* doc) : VCWidget(parent, doc)
{
    /* Set the class name "VCSlider" as the object name as well */
    setObjectName(VCSlider::staticMetaObject.className());

    m_hbox = NULL;
    m_topLabel = NULL;
    m_slider = NULL;
    m_knob = NULL;
    m_bottomLabel = NULL;

    m_valueDisplayStyle = ExactValue;

    m_levelLowLimit = 0;
    m_levelHighLimit = UCHAR_MAX;

    m_levelValue = 0;
    m_levelValueChanged = false;

    m_playbackFunction = Function::invalidId();
    m_playbackValue = 0;
    m_playbackValueChanged = false;

    m_submasterValue = UCHAR_MAX;

    m_widgetMode = WSlider;

    setType(VCWidget::SliderWidget);
    setCaption(QString());
    setFrameStyle(KVCFrameStyleSunken);

    /* Main VBox */
    new QVBoxLayout(this);

    /* Top label */
    m_topLabel = new QLabel(this);
    m_topLabel->setAlignment(Qt::AlignHCenter);

    layout()->addWidget(m_topLabel);

    /* Slider's HBox |stretch|slider|stretch| */
    m_hbox = new QHBoxLayout();

    /* Put stretchable space before the slider (to its left side) */
    m_hbox->addStretch();

    /* The slider */
    m_slider = new ClickAndGoSlider(this);

    m_hbox->addWidget(m_slider);
    m_slider->setRange(0, 255);
    m_slider->setPageStep(1);
    m_slider->setInvertedAppearance(false);
    m_slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    m_slider->setMinimumWidth(32);
    m_slider->setMaximumWidth(80);
    m_slider->setStyleSheet(CNG_DEFAULT_STYLE);

    connect(m_slider, SIGNAL(valueChanged(int)),
            this, SLOT(slotSliderMoved(int)));
    m_externalMovement = false;

    /* Put stretchable space after the slider (to its right side) */
    m_hbox->addStretch();

    layout()->addItem(m_hbox);

    /* Click & Go button */
    m_cngType = ClickAndGoWidget::None;

    m_cngButton = new QToolButton(this);
    m_cngButton->setFixedSize(48, 48);
    m_cngButton->setIconSize(QSize(42, 42));
    m_menu = new QMenu(this);
    QWidgetAction* action = new QWidgetAction(this);
    m_cngWidget = new ClickAndGoWidget();
    action->setDefaultWidget(m_cngWidget);
    m_menu->addAction(action);
    m_cngButton->setMenu(m_menu);
    m_cngButton->setPopupMode(QToolButton::InstantPopup);
    layout()->addWidget(m_cngButton);
    layout()->setAlignment(m_cngButton, Qt::AlignHCenter);
    m_cngButton->hide();

    connect(m_cngWidget, SIGNAL(levelChanged(uchar)),
            this, SLOT(slotClickAndGoLevelChanged(uchar)));
    connect(m_cngWidget, SIGNAL(colorChanged(QRgb)),
            this, SLOT(slotClickAndGoColorChanged(QRgb)));
    connect(m_cngWidget, SIGNAL(levelAndPresetChanged(uchar,QImage)),
            this, SLOT(slotClickAndGoLevelAndPresetChanged(uchar, QImage)));

    /* Bottom label */
    m_bottomLabel = new QLabel(this);
    layout()->addWidget(m_bottomLabel);
    m_bottomLabel->setAlignment(Qt::AlignCenter);
    m_bottomLabel->setWordWrap(true);
    m_bottomLabel->hide();

    setMinimumSize(20, 20);
    QSettings settings;
    QVariant var = settings.value(SETTINGS_SLIDER_SIZE);
    if (var.isValid() == true)
        resize(var.toSize());
    else
        resize(VCSlider::defaultSize);

    /* Initialize to playback mode by default */
    setInvertedAppearance(false);
    setSliderMode(Playback);

    /* Update the slider according to current mode */
    slotModeChanged(mode());

    /* Listen to fixture removals so that LevelChannels can be removed when
       they no longer point to an existing fixture->channel */
    connect(m_doc, SIGNAL(fixtureRemoved(quint32)),
            this, SLOT(slotFixtureRemoved(quint32)));
}
コード例 #19
0
ファイル: moodform.cpp プロジェクト: milohr/babe
MoodForm::MoodForm(QWidget *parent) :
    QWidget(parent)
{
    this->setWindowTitle("Moods");
    this->setWindowFlags(Qt::Dialog);
    this->setWindowModality(Qt::ApplicationModal);

    auto moodMap = BAE::loadSettings("MOODS", "SETTINGS", QMap<QString, QVariant>()).toMap();

    auto moodsLayout = new QGridLayout;

    QList<QLineEdit*> edits;

    auto moods = BAE::MoodColors;

    for(int i=0; i<moods.size(); i++)
    {
        auto colorTag = new QToolButton(this);
        colorTag->setAutoRaise(true);
        colorTag->setStyleSheet(QString("QToolButton { background-color: %1;}").arg(moods.at(i)));
        colorTag->setEnabled(false);

        auto lineEdit = new QLineEdit(this);
        lineEdit->setFrame(false);
        lineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        lineEdit->setText(moodMap[moods[i]].toStringList().join(","));
        edits << lineEdit;

        auto layout = new QHBoxLayout;
        auto frame = new QFrame(this);
        frame->setMaximumHeight(colorTag->size().height());
        frame->setFrameStyle(QFrame::StyledPanel);
        frame->setFrameShadow(QFrame::Sunken);
        frame->setLayout(layout);
        layout->setContentsMargins(0,0,0,0);
        layout->setSpacing(0);

        layout->addWidget(colorTag);
        layout->addWidget(lineEdit);

        moodsLayout->addWidget(frame,i,0);
    }
    auto acceptBtn = new QPushButton("Save", this);
    connect(acceptBtn, &QPushButton::clicked,[=]()
    {
        QMap<QString, QVariant> map;
        auto i = 0;
        for(auto line: edits)
        {
            map.insert(moods[i], line->text().trimmed().split(","));
            i++;
        }

        BAE::saveSettings("MOODS", map, "SETTINGS");
        qDebug()<<map;
       emit this->saved();
    });

    moodsLayout->addWidget(acceptBtn,moods.size(),0);
    this->setLayout(moodsLayout);
}
コード例 #20
0
ファイル: tst_qlayout.cpp プロジェクト: husninazer/qt
 SizeHinterFrame(const QSize &sh, const QSize &msh = QSize())
     : QFrame(0), sh(sh), msh(msh) {
     setFrameStyle(QFrame::Box | QFrame::Plain);
 }
コード例 #21
0
ファイル: SearchPopup.cpp プロジェクト: corelon/paco
SearchPopup::SearchPopup(QWidget* widget, QPoint pos, QAbstractItemModel* model, QWidget* quickInfo, QString pattern)
	: QFrame(0, Qt::Popup),
	  widget_(widget),
	  window_(widget->window()),
	  listView_(new QListView(this)),
	  quickInfo_(quickInfo),
	  origMousePos_(QCursor::pos()),
	  preeditString_(pattern),
	  preeditCursor_(pattern.length()),
	  commited_(false)
{
	setAttribute(Qt::WA_DeleteOnClose);
	
	widget_->installEventFilter(this);
	window_->installEventFilter(this);
	
	listView_->viewport()->installEventFilter(this);
	listView_->viewport()->setMouseTracking(true);
	listView_->setCursor(Qt::PointingHandCursor);
	listView_->setTextElideMode(Qt::ElideMiddle);
	listView_->setModel(model);
	
	SearchPatternHighlighter* patternHighlighter = new SearchPatternHighlighter(listView_);
	listView_->setItemDelegate(patternHighlighter);
	connect(this, SIGNAL(searchPatternChanged(const QString&)), patternHighlighter, SLOT(setPattern(const QString&)));
	
	if (!model->parent())
		model->setParent(listView_);
	listView_->setEditTriggers(QAbstractItemView::NoEditTriggers);
	listView_->setSelectionMode(QAbstractItemView::SingleSelection);
	connect(listView_, SIGNAL(clicked(const QModelIndex&)), this, SLOT(commit(const QModelIndex&)));
	connect(
		listView_->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
		this, SLOT(currentChanged(const QModelIndex&, const QModelIndex&))
	);
	
	#ifdef QT_MAC_USE_COCOA
	setFrameStyle(QFrame::NoFrame);
	#else
	setFrameStyle(QFrame::Plain|QFrame::StyledPanel);
	#endif
	listView_->setFrameStyle(QFrame::NoFrame);
	
	QVBoxLayout* col = new QVBoxLayout;
	col->setSpacing(0);
	col->setMargin(0);
	col->addWidget(listView_);
	if (quickInfo_) {
		QFrame* hl = new QFrame;
		hl->setFrameStyle(QFrame::Raised|QFrame::HLine);
		col->addWidget(hl);
		col->addWidget(quickInfo_);
		quickInfo_->setMaximumWidth(listView_->sizeHint().width()); // quick HACK
	}
	setLayout(col);
	
	listView_->setFocusPolicy(Qt::NoFocus);
		// ensure list view is not grabbing keyboard input and is not showing focus rectangle
	
	connect(
		this, SIGNAL(searchPatternChanged(const QString&)),
		this, SLOT(selectItemByPattern(const QString&))
	);
	
	QTimer::singleShot(0, this, SLOT(selectItem()));
	// QTimer::singleShot(0, this, SLOT(updateInputContext()));
	move(widget->mapToGlobal(pos));
	show();
}
コード例 #22
0
KPrPresenterViewToolWidget::KPrPresenterViewToolWidget(QWidget *parent)
    : QFrame(parent)
{
    QSize iconSize( 32, 32 );
    QHBoxLayout *mainLayout = new QHBoxLayout;

    QHBoxLayout *hLayout = new QHBoxLayout;
    QToolButton *toolButton = new QToolButton;
    toolButton->setIcon(koIcon("go-previous"));
    toolButton->setIconSize( iconSize );
    connect( toolButton, SIGNAL(clicked()), this, SIGNAL(previousSlideClicked()) );
    hLayout->addWidget(toolButton);
    toolButton = new QToolButton;
    toolButton->setIcon(koIcon("go-next"));
    toolButton->setIconSize( iconSize );
    connect( toolButton, SIGNAL(clicked()), this, SIGNAL(nextSlideClicked()) );
    hLayout->addWidget( toolButton );

    mainLayout->addLayout(hLayout);
    mainLayout->addSpacing( 5 );
    QFrame *frame = new QFrame;
    frame->setFrameStyle(QFrame::VLine | QFrame::Sunken);
    mainLayout->addWidget(frame);
    mainLayout->addSpacing( 5 );

    m_slidesToolButton = new QToolButton;
    m_slidesToolButton->setCheckable( true );
    m_slidesToolButton->setIcon(koIcon("view-list-icons"));
    m_slidesToolButton->setIconSize( iconSize );
    connect( m_slidesToolButton, SIGNAL(toggled(bool)), this, SIGNAL(slideThumbnailsToggled(bool)) );
    mainLayout->addWidget( m_slidesToolButton );

    mainLayout->addSpacing( 5 );
    frame = new QFrame;
    frame->setFrameStyle( QFrame::VLine | QFrame::Raised );
    mainLayout->addWidget( frame );
    mainLayout->addSpacing( 5 );

    hLayout = new QHBoxLayout;
    QLabel *iconLabel = new QLabel;
    iconLabel->setPixmap(koIcon("user-away").pixmap(iconSize));
    hLayout->addWidget( iconLabel );
    m_clockLabel = new QLabel( QTime::currentTime().toString( "hh:mm:ss ap" ) );
    m_clockLabel->setStyleSheet("QLabel { font-size: 24px }");
    hLayout->addWidget( m_clockLabel );
    mainLayout->addLayout( hLayout );

    mainLayout->addSpacing( 5 );
    frame = new QFrame;
    frame->setFrameStyle( QFrame::VLine | QFrame::Plain );
    mainLayout->addWidget(frame);
    mainLayout->addSpacing(5);

    hLayout = new QHBoxLayout;
    iconLabel = new QLabel;
    iconLabel->setPixmap(koIcon("chronometer").pixmap(iconSize));
    hLayout->addWidget(iconLabel);
    m_timerLabel = new QLabel( "00:00:00");
    m_timerLabel->setStyleSheet("QLabel { font-size: 24px }");
    hLayout->addWidget( m_timerLabel );
    mainLayout->addLayout(hLayout);

    setLayout(mainLayout);
    setFrameStyle(QFrame::StyledPanel | QFrame::Raised);

    m_currentTime.start();
    m_clockTimer = new QTimer( this );
    connect( m_clockTimer, SIGNAL(timeout()), this, SLOT(updateClock()) );
    m_clockTimer->start( 1000 );
}
コード例 #23
0
ファイル: gltx_frame.cpp プロジェクト: cwarden/quasar
GltxFrame::GltxFrame(MainWindow* main, const QString& numText, QWidget* parent)
    : QGroupBox(parent, "GltxFrame"), _main(main), _quasar(main->quasar())
{
    numberLabel = new QLabel(numText, this);
    number = new LineEdit(14, this);
    numberLabel->setBuddy(number);

    QLabel* dateLabel = new QLabel(tr("&Date:"), this);
    date = new DatePopup(this);
    dateLabel->setBuddy(date);

    QLabel* storeLabel = new QLabel(tr("Store:"), this);
    storeLookup = new StoreLookup(_main, parent);
    store = new LookupEdit(storeLookup, this);
    store->setLength(20);
    storeLabel->setBuddy(store);

    QLabel* referenceLabel = new QLabel(tr("Reference:"), this);
    reference = new LineEdit(9, this);
    referenceLabel->setBuddy(reference);

    QLabel* timeLabel = new QLabel(tr("&Time:"), this);
    time = new TimeEdit(this);
    timeLabel->setBuddy(time);

    QLabel* stationLabel = new QLabel(tr("Station:"), this);
    station = new LookupEdit(new StationLookup(_main, parent), this);
    station->setLength(20);
    stationLabel->setBuddy(station);

    QLabel* shiftLabel = new QLabel(tr("Shift:"), this);
    shift = new LookupEdit(new GltxLookup(_main, parent, DataObject::SHIFT),
			    this);
    shift->setSizeInfo(8, '9');
    shift->setFocusPolicy(ClickFocus);
    shiftLabel->setBuddy(shift);

    QLabel* employeeLabel = new QLabel(tr("Employee:"), this);
    employee = new LookupEdit(new EmployeeLookup(_main, parent), this);
    employee->setLength(20);
    employeeLabel->setBuddy(employee);

    memoLabel = new QLabel(tr("&Memo:"), this);
    memo = new LineEdit(this);
    memo->setMaxLength(40);
    memo->setMinimumWidth(memo->fontMetrics().width('x') * 40);
    memoLabel->setBuddy(memo);

    grid = new QGridLayout(this, 1, 1, frameWidth() * 2);
    grid->setSpacing(3);
    grid->setMargin(6);
    grid->setColStretch(2, 1);
    grid->addColSpacing(2, 10);
    grid->setColStretch(5, 1);
    grid->addColSpacing(5, 10);
    grid->addWidget(numberLabel, 1, 0);
    grid->addWidget(number, 1, 1);
    grid->addWidget(dateLabel, 1, 3);
    grid->addWidget(date, 1, 4);
    grid->addWidget(storeLabel, 1, 6);
    grid->addWidget(store, 1, 7);
    grid->addWidget(referenceLabel, 2, 0);
    grid->addWidget(reference, 2, 1);
    grid->addWidget(timeLabel, 2, 3);
    grid->addWidget(time, 2, 4);
    grid->addWidget(stationLabel, 2, 6);
    grid->addWidget(station, 2, 7);
    grid->addWidget(shiftLabel, 3, 3);
    grid->addWidget(shift, 3, 4);
    grid->addWidget(employeeLabel, 3, 6);
    grid->addWidget(employee, 3, 7);
    grid->addWidget(memoLabel, 9, 0);
    grid->addMultiCellWidget(memo, 9, 9, 1, 7);

    // Hide store if only one possible
    if (_quasar->storeCount() == 1) {
	storeLabel->hide();
	store->hide();
    }

    setFrameStyle(QFrame::Raised | QFrame::Panel);
    memo->setFocus();
}
コード例 #24
0
ファイル: strip.cpp プロジェクト: songo/muse
Strip::Strip(QWidget* parent, MusECore::Track* t, bool hasHandle)
   : QFrame(parent)
      {
      setMouseTracking(true);
      
      _curGridRow = 0;
      _userWidth = 0;
      autoType = 0;
      _visible = true;
      dragOn=false;
      setAttribute(Qt::WA_DeleteOnClose);
      iR            = 0;
      oR            = 0;
      
      ///setBackgroundRole(QPalette::Mid);
      setFrameStyle(Panel | Raised);
      setLineWidth(2);
      
      track    = t;
      meter[0] = 0;
      meter[1] = 0;
      setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding));
      
      grid = new QGridLayout();
      grid->setContentsMargins(0, 0, 0, 0);
      grid->setSpacing(0);
      
      _handle = 0;
      if(hasHandle)
      {
        _handle = new ExpanderHandle();
        connect(_handle, SIGNAL(moved(int)), SLOT(changeUserWidth(int)));
        QHBoxLayout* hlayout = new QHBoxLayout(this);
        hlayout->setContentsMargins(0, 0, 0, 0);
        hlayout->setSpacing(0);
        hlayout->addLayout(grid);
        hlayout->addWidget(_handle);
      }
      else
      {
        setLayout(grid);
      }
        
      //---------------------------------------------
      //    label
      //---------------------------------------------

      //label = new QLabel(this);
      // NOTE: This was required, otherwise the strip labels have no colour in the mixer only - track info OK !
      // Not sure why...
      label = new QLabel(this);
      label->setObjectName(track->cname());
      label->setTextFormat(Qt::PlainText);
      
      // Unfortunately for the mixer labels, QLabel doesn't support the BreakAnywhere flag.
      // Changed by Tim. p3.3.9
      //label->setAlignment(AlignCenter);
      //label->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
      // MusE-2 Tested: TextWrapAnywhere actually works, but in fact it takes precedence 
      //  over word wrap, so I found it is not really desirable. Maybe with a user setting...
      //label->setAlignment(Qt::AlignCenter | Qt::TextWordWrap | Qt::TextWrapAnywhere);
      // changed by Orcan: We can't use Qt::TextWordWrap in alignment in Qt4.
      label->setAlignment(Qt::AlignCenter);
      label->setWordWrap(true);
      label->setAutoFillBackground(true);
      label->setLineWidth(2);
      label->setFrameStyle(Sunken | StyledPanel);
      
      label->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
      
      setLabelText();
      setLabelFont();
      
      grid->addWidget(label, _curGridRow++, 0, 1, 3); // REMOVE Tim. Trackinfo. Changed. TEST
      }
コード例 #25
0
ファイル: vcslider.cpp プロジェクト: speakman/qlc
VCSlider::VCSlider(QWidget* parent) : VCWidget(parent)
{
	/* Set the class name "VCSlider" as the object name as well */
	setObjectName(VCSlider::staticMetaObject.className());

	m_hbox = NULL;
	m_topLabel = NULL;
	m_slider = NULL;
	m_bottomLabel = NULL;
	m_tapButton = NULL;

	m_sliderMode = Bus;
	m_valueDisplayStyle = ExactValue;

	m_levelLowLimit = 0;
	m_levelHighLimit = 255;

	m_bus = Bus::defaultFade();
	m_busLowLimit = KDefaultBusLowLimit;
	m_busHighLimit = KDefaultBusHighLimit;

	m_sliderValue = 0;

	m_time = NULL;

	setCaption(QString::null);
	setFrameStyle(KVCFrameStyleSunken);

	/* Main VBox */
	new QVBoxLayout(this);

	/* Top label */
	m_topLabel = new QLabel(this);
	layout()->addWidget(m_topLabel);
	m_topLabel->setAlignment(Qt::AlignHCenter);

	/* Slider's HBox |stretch|slider|stretch| */
	m_hbox = new QHBoxLayout();
	layout()->addItem(m_hbox);

	/* Put stretchable space before the slider (to its left side) */
	m_hbox->addStretch();

	/* The slider */
	m_slider = new QSlider(this);
	m_slider->setStyle(App::saneStyle());
	m_hbox->addWidget(m_slider);
	m_slider->setRange(KDefaultBusLowLimit * KFrequency,
			   KDefaultBusHighLimit * KFrequency);
	m_slider->setPageStep(1);
	m_slider->setInvertedAppearance(false);
	connect(m_slider, SIGNAL(valueChanged(int)),
		this, SLOT(slotSliderMoved(int)));

	/* Put stretchable space after the slider (to its right side) */
	m_hbox->addStretch();

	/* Tap button */
	m_tapButton = new QPushButton(this);
	layout()->addWidget(m_tapButton);
	connect(m_tapButton, SIGNAL(clicked()),
		this, SLOT(slotTapButtonClicked()));
	m_time = new QTime();

	/* Bottom label */
	m_bottomLabel = new QLabel(this);
	layout()->addWidget(m_bottomLabel);
	m_bottomLabel->setAlignment(Qt::AlignCenter);
	m_bottomLabel->hide();

	resize(QPoint(60, 220));

	/* Initialize to bus mode by default */
	setBus(Bus::defaultFade());
	setSliderMode(Bus);
	setSliderValue(0);
	slotSliderMoved(0);
	setInvertedAppearance(true);

	/* Update the slider according to current mode */
	slotModeChanged(_app->mode());
}
コード例 #26
0
ファイル: controller.cpp プロジェクト: rologne/vlc
/**********************************************************************
 * Fullscrenn control widget
 **********************************************************************/
FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWidget *_parent )
                           : AbstractController( _p_i, _parent )
{
    RTL_UNAFFECTED_WIDGET
    i_mouse_last_x      = -1;
    i_mouse_last_y      = -1;
    b_mouse_over        = false;
    i_mouse_last_move_x = -1;
    i_mouse_last_move_y = -1;
#if HAVE_TRANSPARENCY
    b_slow_hide_begin   = false;
    i_slow_hide_timeout = 1;
#endif
    b_fullscreen        = false;
    i_hide_timeout      = 1;
    i_screennumber      = -1;

    vout.clear();

    setWindowFlags( Qt::ToolTip );
    setMinimumWidth( FSC_WIDTH );
    setMinimumHeight( FSC_HEIGHT );
    isWideFSC = false;

    setFrameShape( QFrame::StyledPanel );
    setFrameStyle( QFrame::Sunken );
    setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );

    QVBoxLayout *controlLayout2 = new QVBoxLayout( this );
    controlLayout2->setContentsMargins( 4, 6, 4, 2 );

    /* First line */
    InputControlsWidget *inputC = new InputControlsWidget( p_intf, this );
    controlLayout2->addWidget( inputC );

    controlLayout = new QHBoxLayout;
    QString line = getSettings()->value( "MainWindow/FSCtoolbar", FSC_TB_DEFAULT ).toString();
    parseAndCreate( line, controlLayout );
    controlLayout2->addLayout( controlLayout );

    /* hiding timer */
    p_hideTimer = new QTimer( this );
    p_hideTimer->setSingleShot( true );
    CONNECT( p_hideTimer, timeout(), this, hideFSC() );

    /* slow hiding timer */
#if HAVE_TRANSPARENCY
    p_slowHideTimer = new QTimer( this );
    CONNECT( p_slowHideTimer, timeout(), this, slowHideFSC() );
    f_opacity = var_InheritFloat( p_intf, "qt-fs-opacity" );
#endif

    vlc_mutex_init_recursive( &lock );

    DCONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ),
              this, setVoutList( vout_thread_t **, int ) );

    /* First Move */
    previousPosition = getSettings()->value( "FullScreen/pos" ).toPoint();
    screenRes = getSettings()->value( "FullScreen/screen" ).toRect();
    isWideFSC = getSettings()->value( "FullScreen/wide" ).toBool();
    i_screennumber = var_InheritInteger( p_intf, "qt-fullscreen-screennumber" );
}
コード例 #27
0
ファイル: kcolordialog.cpp プロジェクト: Fat-Zer/tdelibs
KColorPatch::KColorPatch( TQWidget *parent ) : TQFrame( parent )
{
	setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
	colContext = 0;
	setAcceptDrops( true);
}