void createUi(PlotViewInterpolation* plot_view) {
    _b1_rbtn = new QRadioButton("no boundary", plot_view);
    _b2_rbtn = new QRadioButton("c1 boundary", plot_view);
    _b3_rbtn = new QRadioButton("c2 boundary", plot_view);
    _b1_rbtn->setDown(true);

    _lbl_weight = new QLabel("lambda", plot_view);
    _lbl_weight->setAlignment(Qt::AlignRight);
    _lbl_weight->adjustSize();

    _sld_precision = new QSlider(Qt::Horizontal, plot_view);
    _sld_precision->setMinimum(1);
    _sld_precision->setMaximum(1000);
    _sld_precision->setTickInterval(1);
    _sld_precision->setValue(20);
    _sld_precision->adjustSize();

    _sld_alpha = new QSlider(Qt::Horizontal, plot_view);
    _sld_alpha->setMinimum(1);
    _sld_alpha->setMaximum(1000);
    _sld_alpha->setTickInterval(1);
    _sld_alpha->setValue(50);
    _sld_alpha->adjustSize();

    _lbl_knot = new QLabel("initial knots", plot_view);
    _lbl_knot->setAlignment(Qt::AlignRight);
    _lbl_knot->adjustSize();

    _lbl_level = new QLabel("level", plot_view);
    _lbl_level->setAlignment(Qt::AlignRight);
    _lbl_knot->adjustSize();

    _sld_level = new QSlider(Qt::Horizontal, plot_view);
    _sld_level->setMinimum(1);
    _sld_level->setMaximum(10);
    _sld_level->setTickInterval(1);
    _sld_level->setValue(1);
    _sld_level->adjustSize();

    QSignalMapper* signal_map = new QSignalMapper(plot_view);
    signal_map->setMapping(_b1_rbtn, 0);  // no boundary
    signal_map->setMapping(_b2_rbtn, 1);  // c1 boundary
    signal_map->setMapping(_b3_rbtn, 2);  // c2 boundary

    QObject::connect(_b1_rbtn, SIGNAL(clicked()), signal_map, SLOT(map()));
    QObject::connect(_b2_rbtn, SIGNAL(clicked()), signal_map, SLOT(map()));
    QObject::connect(_b3_rbtn, SIGNAL(clicked()), signal_map, SLOT(map()));
    QObject::connect(signal_map, SIGNAL(mapped(int)), plot_view,
                     SLOT(setBoundary(int)));
    QObject::connect(_sld_precision, &QSlider::valueChanged, plot_view,
                     &PlotViewInterpolation::changePrecision);
    QObject::connect(_sld_alpha, &QSlider::valueChanged, plot_view,
                     &PlotViewInterpolation::changeAlpha);
    QObject::connect(_sld_level, &QSlider::valueChanged, plot_view,
                     &PlotViewInterpolation::changeLevel);
  }
예제 #2
0
bool ImagePlugin::initialize( KIO::RenameDlg_Mode mode, const QString &_src, const QString &_dest,
		  const QString &/*mimeSrc*/,
		  const QString &/*mimeDest*/,
		  KIO::filesize_t /*sizeSrc*/,
		  KIO::filesize_t /*sizeDest*/,
		  time_t /*ctimeSrc*/,
		  time_t /*ctimeDest*/,
		  time_t /*mtimeSrc*/,
		  time_t /*mtimeDest*/ ) 
{
  QGridLayout *lay = new QGridLayout(this, 2, 3, 5  );
  if( mode & KIO::M_OVERWRITE )
  {
    QLabel *label = new QLabel(this );
    label->setText(i18n("You want to overwrite the left picture with the one on the right.") );
    label->adjustSize();
    lay->addMultiCellWidget(label, 1, 1, 0, 2,  Qt::AlignHCenter  );
    adjustSize();
  }
  ImageVisualizer *left= new ImageVisualizer(this, "Visualizer Left", _dest );
  ImageVisualizer *right = new ImageVisualizer( this, "Visualizer Right", _src );
  lay->addWidget(left, 2, 0 );
  lay->addWidget(right, 2, 2 );
  adjustSize();
  return true;
}
예제 #3
0
void PlotScene::displayLabels(const QPointF& mousePos, const QPointF& scenePos)
{
    QPalette palette;
    PlotCurve* currentCurve = NULL;

    for (int i(0); i < this->curves.count(); i++)
    {
        currentCurve = this->curves.at(i);

        /* Get the CoordinateItem which abscisse is the nearest
         * to the mouse position abscisse */
        CoordinateItem* itemAtMousePos =
                currentCurve->nearestCoordinateitemsOfX(scenePos.x());

        if (itemAtMousePos == NULL) continue;

        // Get the label associate to the curve
        QLabel* curveLabel = this->curveLabels.at(i);
        if (curveLabel == NULL) continue;

        // Change the text color of the label associate to the curve
        palette.setColor(QPalette::WindowText, currentCurve->getPen().color());
        curveLabel->setPalette(palette);

        // Change the text of the label associate to the curve
        curveLabel->setText(QString("%1, %2").arg(
                                itemAtMousePos->x(), 6, 'f', 2).arg(
                                itemAtMousePos->y(), 6, 'f', 2));
        curveLabel->adjustSize();

        // Move the label
        curveLabel->move(mousePos.x(), mousePos.y() - (i * 12));
    }
}
예제 #4
0
void
MessageBar::show( const QString& message, const QString& id )
{    
    QLabel* label = findChild<QLabel*>( id );
    
    if (label && id.size()) {
        if (message.isEmpty())
        {
            QProgressBar* p = label->findChild<QProgressBar*>();
            if (p)
                p->setRange( 0, 1 ),
                p->setValue( 1 );
            QTimer::singleShot( 3000, label, SLOT(deleteLater()) );
        }
        else
            label->setText( message );
        return;
    }
    
    label = new QLabel( message, ui.papyrus );
    label->setBackgroundRole( QPalette::Base );
    label->setMargin( 8 );
    label->setIndent( 4 );
    label->setTextFormat( Qt::RichText );
    label->setOpenExternalLinks( true );
    label->setTextInteractionFlags( Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse );
    
    ImageButton* close = new ImageButton( ":/buckets/radio_clear_all_x.png" );
    QHBoxLayout* h = new QHBoxLayout( label );
    h->addStretch();
    
    if (id.size())
    {
        label->setObjectName( id );
        
        QProgressBar* p;
        h->addWidget( p = new QProgressBar );
        p->setRange( 0, 0 );
        p->setFixedWidth( 90 );
    }

    h->addWidget( close );
    h->setMargin( 4 );
    
    label->setFixedWidth( width() );
    label->adjustSize();
    label->show();
    
    ui.papyrus->move( 0, -label->height() );

    doLayout();
    
    connect( close, SIGNAL(clicked()), label, SLOT(deleteLater()) );    
    connect( label, SIGNAL(destroyed()), SLOT(onLabelDestroyed()), Qt::QueuedConnection );
        
    m_timeline->setFrameRange( height(), ui.papyrus->height() );
    m_timeline->start();
}
예제 #5
0
/**
 * @brief MapManager::printVictimImage slot chiamato quando il robot trova una vittima
 * @param cvImage l'immagine da mostrare
 */
void MapManager::printVictimImage(cv::Mat cvImage)
{
    QImage image = Mat2QImage(cvImage);

    QLabel *victimImage = new QLabel();
    victimImage->setPixmap(QPixmap::fromImage((image)));
    victimImage->adjustSize();

    layout->addWidget(victimImage);
}
예제 #6
0
void GCOutputWindow::computationCompleted(QImage result)
{
  QLabel* imagelabel = new QLabel(this);
  imagelabel->setBackgroundRole(QPalette::Base);
  imagelabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
  imagelabel->setPixmap(QPixmap::fromImage(result));
  imagelabel->adjustSize();

  QScrollArea* scrollview = new QScrollArea(this);
  scrollview->setWidget(imagelabel);

  m_OutputTabView->addTab(scrollview, "Mask");
  m_OutputTabView->setCurrentWidget(scrollview);
  m_OutputStackView->setCurrentIndex(1);
}
예제 #7
0
PasswordDialog *PasswordDialog::getPassword(QWidget *parent, const QString &windowTitle, const QString &description,
                                            const QString &errorMessage)
{
    auto d = new PasswordDialog(parent);
    d->setWindowTitle(windowTitle);
    d->ui.descriptionLabel->setText(description);
    d->ui.passwordLineEdit->setEchoMode(QLineEdit::Password);

    // fight the word wrapping beast, also see below
    int l,r,t,b; // we're gonna need the horizontal margins
    d->ui.verticalLayout->getContentsMargins(&l,&t,&r,&b);
    QList<QLabel*> fixedLabels; // and the labels we adjusted

    // 1. fix the dialog width, assuming to be wanted.
    d->setMinimumWidth(d->width());
    // 2. fix the label width
    fixedLabels << d->ui.descriptionLabel;
    // NOTICE: d->ui.descriptionLabel is inside a grid layout, which however has 0 margins
    d->ui.descriptionLabel->setMinimumWidth(d->width() - (l+r));
    // 3. have QLabel figure the size for that width and the content
    d->ui.descriptionLabel->adjustSize();
    // 4. make the label a fixed size element
    d->ui.descriptionLabel->setFixedSize(d->ui.descriptionLabel->size());
    d->adjustSize();

    if (!errorMessage.isEmpty()) {
        QLabel *errorLabel = new QLabel(d);
        d->ui.verticalLayout->insertWidget(0, errorLabel);
        errorLabel->setWordWrap(true);
        errorLabel->setText(errorMessage + QLatin1String("\n<hr>"));
        errorLabel->setTextFormat(Qt::RichText);

        // wordwrapping labels are a problem of its own
        fixedLabels << errorLabel;
        errorLabel->setMinimumWidth(d->width() - (l+r));
        errorLabel->adjustSize();
        errorLabel->setFixedSize(errorLabel->size());
    }

    d->adjustSize();
    d->setMinimumWidth(0);
    foreach(QLabel *label, fixedLabels) {
        label->setMinimumSize(0, 0);
        label->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
    }
예제 #8
0
void se_kbmwidget::initUI()
{
    this->setWindowIcon(QIcon(":/img/Logo"));
    //this->setWindowFlags(Qt::Tool | Qt::X11BypassWindowManagerHint);
    this->setGeometry(QRect(380,140,650,400));
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setModal(true);
    m_backgroundWidget = new Kbmbasewidget(this);
    m_backgroundWidget->setGeometry(rect());
    m_backgroundWidget->lower();
    QLabel *logoLabel = new QLabel;
    logoLabel->setPixmap(QPixmap(":/img/logo"));//logo
    QLabel *textLabel = new QLabel;
    textLabel->setText("OS 测评之家 1.0");//界面tital
    textLabel->setStyleSheet("color:white;");
    textLabel->adjustSize();
    QHBoxLayout *hLayout = new QHBoxLayout;//左上角布局
    hLayout->addWidget(logoLabel);
    hLayout->addWidget(textLabel);
    stack = new QStackedWidget;
    buttonGroup = new SysButtonGroup;//右上角按钮组
    connect(buttonGroup, SIGNAL(closeWidget()), this, SIGNAL(closeWidget()));
    QWidget *title = new QWidget;//顶部第一页面
    title->setAttribute(Qt::WA_TranslucentBackground);
    title->setLayout(hLayout);

    kbm = new MainKBMview;//显示页面
    wait = new LoadingDialog;//等待页面

    stack->addWidget(wait);
    stack->addWidget(kbm);

    QHBoxLayout *titleLayout = new QHBoxLayout;
    titleLayout->addWidget(title, 0, Qt::AlignLeft | Qt::AlignTop);
    titleLayout->addStretch();
    titleLayout->addWidget(buttonGroup, 0, Qt::AlignRight | Qt::AlignTop);
    titleLayout->setContentsMargins(10, 0, 0, 0);

    QVBoxLayout *vLayout = new QVBoxLayout;
    vLayout->addLayout(titleLayout);
    vLayout->addWidget(stack);
    vLayout->setSpacing(0);
    vLayout->setContentsMargins(0,0,0,0);
    this->setLayout(vLayout);
}
예제 #9
0
void ImagePlugin::handle( KIO::RenameDialog_Mode mode, const KIO::RenameDialogPlugin::FileItem& src,
                          const KIO::RenameDialogPlugin::FileItem& dst ) {
    QGridLayout *lay = new QGridLayout( this );
    if( mode & KIO::M_OVERWRITE ) {
        QLabel *label = new QLabel(this );
        label->setText(i18n("You want to overwrite the left picture with the one on the right.") );
        label->adjustSize();
        lay->addWidget(label, 1, 0, 1, 3, Qt::AlignHCenter );
        adjustSize();
    }

    ImageVisualizer *left= new ImageVisualizer(this, dst.url() );
    ImageVisualizer *right = new ImageVisualizer( this, src.url() );

    lay->addWidget(left, 2, 0 );
    lay->addWidget(right, 2, 2 );
    adjustSize();
}
예제 #10
0
파일: Window.cpp 프로젝트: barthess/volat3
QLabel *HUD2::InitLabel( int x, int y, int h, QString text, QColor c )
{
   QLabel *lab = new QLabel( this );
   //QFont     f = QFont( "Courier", h );
   QFont     f = QFont( "Vera", h );
   f.setBold( true );
   QPalette  p = lab->palette();
   
   p.setColor( QPalette::WindowText, c );

   lab->setGeometry( x, y, 0, 0 );
   lab->setPalette( p );
   lab->setFont(f);
   lab->setText(text);
   lab->adjustSize();

   return lab;
}
예제 #11
0
void Progression::updateProgressBar(QString file, qint64 pos, QString currentFile){
	ProgressBars[file]->setValue((int) pos);
	qDebug() << "Update" << vbl->count();
	if(currentFile != "")
	{
		for(int i = 0; i < vbl->count(); i++)
		{
			QLayoutItem* item = vbl->itemAt(i);
			QWidget* widget = item->widget();
			if (widget) {
				QLabel *label = qobject_cast<QLabel *>(widget);
				if(label->text().contains(file))
				{
					label->setText(file + " -> " + currentFile);
					label->adjustSize();
				}
			}
		}
	}
	this->adjustSize();
}
예제 #12
0
void JanelaOpcoes::escreve() {
    QLabel *lbl;

    lbl = new QLabel("Curva:", tela);
    lbl->setGeometry(10, 15, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("Cor:", tela);
    lbl->setGeometry(40, 45, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("R:", tela);
    lbl->setGeometry(85, 45, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("G:", tela);
    lbl->setGeometry(180, 45, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("B:", tela);
    lbl->setGeometry(275, 45, 0, 0); lbl->adjustSize();
    lbl->show();

    for(int i = 0 ; i < 3 ; i++) {
        sb_corcurva[i] = new QSpinBox(tela);
        sb_corcurva[i]->setRange(0, 255);
        sb_corcurva[i]->setValue(def->cor_curva[i]);
        sb_corcurva[i]->setGeometry(100 + 95*i, 40, 0, 0); sb_corcurva[i]->adjustSize();
    }

    lbl = new QLabel("Largura:", tela);
    lbl->setGeometry(40, 85, 0, 0); lbl->adjustSize();
    lbl->show();

    sb_larguracurva = new QSpinBox(tela);
    sb_larguracurva->setRange(0, 10);
    sb_larguracurva->setValue(def->w_curva);
    sb_larguracurva->setGeometry(107, 80, 0, 0); sb_larguracurva->adjustSize();

    lbl = new QLabel("Ponto:", tela);
    lbl->setGeometry(10, 125, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("Cor:", tela);
    lbl->setGeometry(40, 155, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("R:", tela);
    lbl->setGeometry(85, 155, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("G:", tela);
    lbl->setGeometry(180, 155, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("B:", tela);
    lbl->setGeometry(275, 155, 0, 0); lbl->adjustSize();
    lbl->show();

    for(int i = 0 ; i < 3 ; i++) {
        sb_corponto[i] = new QSpinBox(tela);
        sb_corponto[i]->setRange(0, 255);
        sb_corponto[i]->setValue(def->cor_ponto[i]);
        sb_corponto[i]->setGeometry(100 + 95*i, 150, 0, 0); sb_corponto[i]->adjustSize();
    }

    lbl = new QLabel("Largura:", tela);
    lbl->setGeometry(40, 195, 0, 0); lbl->adjustSize();
    lbl->show();

    sb_larguraponto = new QSpinBox(tela);
    sb_larguraponto->setRange(0, 10);
    sb_larguraponto->setValue(def->w_ponto);
    sb_larguraponto->setGeometry(107, 190, 0, 0); sb_larguraponto->adjustSize();

    lbl = new QLabel("Ponto Tangente:", tela);
    lbl->setGeometry(10, 235, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("Cor:", tela);
    lbl->setGeometry(40, 265, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("R:", tela);
    lbl->setGeometry(85, 265, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("G:", tela);
    lbl->setGeometry(180, 265, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("B:", tela);
    lbl->setGeometry(275, 265, 0, 0); lbl->adjustSize();
    lbl->show();

    for(int i = 0 ; i < 3 ; i++) {
        sb_cortangente[i] = new QSpinBox(tela);
        sb_cortangente[i]->setRange(0, 255);
        sb_cortangente[i]->setValue(def->cor_tangente[i]);
        sb_cortangente[i]->setGeometry(100 + 95*i, 260, 0, 0); sb_cortangente[i]->adjustSize();
    }

    lbl = new QLabel("Largura:", tela);
    lbl->setGeometry(40, 305, 0, 0); lbl->adjustSize();
    lbl->show();

    sb_larguratangente = new QSpinBox(tela);
    sb_larguratangente->setRange(0, 10);
    sb_larguratangente->setValue(def->w_tangente);
    sb_larguratangente->setGeometry(107, 300, 0, 0); sb_larguratangente->adjustSize();

    lbl = new QLabel("Reta Tangente:", tela);
    lbl->setGeometry(10, 345, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("Cor:", tela);
    lbl->setGeometry(40, 375, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("R:", tela);
    lbl->setGeometry(85, 375, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("G:", tela);
    lbl->setGeometry(180, 375, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("B:", tela);
    lbl->setGeometry(275, 375, 0, 0); lbl->adjustSize();
    lbl->show();

    for(int i = 0 ; i < 3 ; i++) {
        sb_corretatangente[i] = new QSpinBox(tela);
        sb_corretatangente[i]->setRange(0, 255);
        sb_corretatangente[i]->setValue(def->cor_retatangente[i]);
        sb_corretatangente[i]->setGeometry(100 + 95*i, 370, 0, 0); sb_corretatangente[i]->adjustSize();
    }

    lbl = new QLabel("Largura:", tela);
    lbl->setGeometry(40, 415, 0, 0); lbl->adjustSize();
    lbl->show();

    sb_larguraretatangente = new QSpinBox(tela);
    sb_larguraretatangente->setRange(0, 10);
    sb_larguraretatangente->setValue(def->w_retatangente);
    sb_larguraretatangente->setGeometry(107, 410, 0, 0); sb_larguraretatangente->adjustSize();

    lbl = new QLabel("Fundo:", tela);
    lbl->setGeometry(10, 455, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("Cor:", tela);
    lbl->setGeometry(40, 485, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("R:", tela);
    lbl->setGeometry(85, 485, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("G:", tela);
    lbl->setGeometry(180, 485, 0, 0); lbl->adjustSize();
    lbl->show();

    lbl = new QLabel("B:", tela);
    lbl->setGeometry(275, 485, 0, 0); lbl->adjustSize();
    lbl->show();

    for(int i = 0 ; i < 3 ; i++) {
        sb_corfundo[i] = new QSpinBox(tela);
        sb_corfundo[i]->setRange(0, 255);
        sb_corfundo[i]->setValue(def->cor_fundo[i]);
        sb_corfundo[i]->setGeometry(100 + 95*i, 480, 0, 0); sb_corfundo[i]->adjustSize();
    }

    ok = new QPushButton("&Ok", tela);
    ok->setGeometry(110, 540, 0, 0); ok->adjustSize();

    cancela = new QPushButton("&Cancela", tela);
    cancela->setGeometry(210, 540, 0, 0); cancela->adjustSize();

    tela->adjustSize();
}
예제 #13
0
PlaylistWidget::PlaylistWidget( QWidget *parent ) :
    QWidget( parent )
{
    //////////////////////////////////////////////////////////////////
    QLabel *databaseFilterLabel;
    QLineEdit *databaseFilter;

    databaseFilterLabel = new QLabel();
    databaseFilterLabel->setText( "Search" );
    databaseFilterLabel->setMinimumWidth( 125 );
    databaseFilterLabel->adjustSize();
    databaseFilter = new QLineEdit();

    QHBoxLayout *searchbar = new QHBoxLayout();
    searchbar->addWidget( databaseFilterLabel );
    searchbar->addWidget( databaseFilter );
    //////////////////////////////////////////////////////////////////

    this->playlistTableModel = new PlaylistTableModel();
    this->playlistTableView = new PlaylistTableView();

    //////////////////////////////////////////////////////////////////
    TrackDelegate * trackDelegate = new TrackDelegate();
    trackDelegate->setPlayIcon( style()->standardIcon( QStyle::SP_MediaPlay ) );
    trackDelegate->setPauseIcon( style()->standardIcon( QStyle::SP_MediaPause ) );

    //////////////////////////////////////////////////////////////////
    this->playlistTableView->setItemDelegate( trackDelegate );
    this->playlistTableView->setModel( this->playlistTableModel );
    this->playlistTableView->setAlternatingRowColors( true );
    this->playlistTableView->setSelectionBehavior( QAbstractItemView::SelectRows );
    this->playlistTableView->setEditTriggers( QAbstractItemView::NoEditTriggers );
    // D&D
    this->playlistTableView->setSelectionMode( QAbstractItemView::ExtendedSelection );
    this->playlistTableView->setDragEnabled( true );
    this->playlistTableView->setAcceptDrops( true );
    this->playlistTableView->setDropIndicatorShown( true );

    //////////////////////////////////////////////////////////////////

    connect( this->playlistTableView,
        SIGNAL( playTrack( const Track * ) ),
        playerengine, SLOT( slotPlayTrack( const Track * ) ) );
    connect(
        playerengine, SIGNAL( updateTrack( const Track * ) ),
        this->playlistTableView, SLOT( slotDisplayTrack( const Track * ) )
    );

    connect(
        this->playlistTableModel, SIGNAL( scrollToCurrentTrack(const QModelIndex &) ),
        this, SLOT( slotScrollToCurrentTrack(const QModelIndex &) )
    );

    connect(    eventmanager, SIGNAL( internetEvent(QVariantMap)),
                this, SLOT( slotInternetEvent(QVariantMap)));

    //////////////////////////////////////////////////////////////////

    connect(    databaseFilter, SIGNAL( textEdited(QString)),
                this, SLOT( slotTextEdited(QString)));

    //////////////////////////////////////////////////////////////////

    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->addWidget( this->playlistTableView );
    mainLayout->addLayout( searchbar );

    //////////////////////////////////////////////////////////////////

    this->setLayout( mainLayout );

    // HOTKEYS ///////////////////////////////////////////////////////

}
예제 #14
0
/**
 * Constructor of the class
 * @param parent
 * @param name
 * @return
 */
NMGModuleToolBoxItem::NMGModuleToolBoxItem( QWidget *parent, QString modName, const QColor & backgroundColor )
		: QWidget( parent )
{
	setObjectName( modName );
	setMouseTracking( true );

	QPalette palette;
	palette.setColor( backgroundRole(), backgroundColor );
	setPalette( palette );

	moduleName = modName;

	QVBoxLayout * layoutVertical = new QVBoxLayout( this );
	layoutVertical->setMargin( 0 );
	layoutVertical->setSpacing( 0 );
	layoutVertical->setObjectName( moduleName + "LayoutVertical" );

	QHBoxLayout * layoutHoritzontal = new QHBoxLayout( 0 );
	layoutHoritzontal->setMargin( 0 );
	layoutHoritzontal->setSpacing( 0 );
	layoutHoritzontal->setObjectName( moduleName + "LayoutHoritzontal" );

	QSpacerItem * leftSpacer = new QSpacerItem( 1, 21, QSizePolicy::Maximum, QSizePolicy::Minimum );
	layoutHoritzontal->addItem( leftSpacer );

	QString toolTip = (( NMGModuleParent * ) NMGModuleManager::self()->getModule( moduleName ) )->getModuleToolTip().c_str();

	QLabel * pixmapLabel1 = new QLabel( this );
	pixmapLabel1->setMaximumSize( QSize( 64, 64 ) );
	pixmapLabel1->setAlignment( Qt::AlignHCenter );
	pixmapLabel1->setObjectName( moduleName + "Label" );

	if ( !toolTip.isEmpty() )
	{
		pixmapLabel1->setToolTip( toolTip );
		pixmapLabel1->setWhatsThis( toolTip );
	}

	QString iconFile = (( NMGModuleParent * ) NMGModuleManager::self()->getModule( moduleName ) )->getModuleIcon().c_str();
	if ( iconFile.isEmpty() ) iconFile = DEFAULT_ICON_NAME;
	pixmapLabel1->setPixmap( * ( NMGImageManager::loadPixmap( iconFile ) ) );
	pixmapLabel1->setScaledContents( TRUE );
	layoutHoritzontal->addWidget( pixmapLabel1 );
	pixmapLabel1->setMouseTracking( true );

	QSpacerItem * rightSpacer = new QSpacerItem( 1, 21, QSizePolicy::Maximum, QSizePolicy::Minimum );
	layoutHoritzontal->addItem( rightSpacer );
	layoutVertical->addLayout( layoutHoritzontal );


	QLabel * txtModuleLabel = new QLabel( "<p align=\"center\">" + moduleName + "</p>", this );
	txtModuleLabel->setObjectName( moduleName + "Label" );
	if ( !toolTip.isEmpty() )
	{
		txtModuleLabel->setToolTip( toolTip );
		txtModuleLabel->setWhatsThis( toolTip );
	}

	QSizePolicy policy1( QSizePolicy::Preferred, QSizePolicy::Preferred );
	policy1.setHorizontalStretch( 0 );
	policy1.setVerticalStretch( 0 );
	policy1.setHeightForWidth( txtModuleLabel->sizePolicy().hasHeightForWidth() );
	txtModuleLabel->setSizePolicy( policy1 );

	/** Size of the label for the plugin's name at toolbar **/
	txtModuleLabel->adjustSize(); //setMaximumSize( QSize( 100, 150 ) );
	QPalette palettelabel;
	palettelabel.setColor( txtModuleLabel->backgroundRole(), backgroundColor );
	txtModuleLabel->setPalette( palettelabel );
	txtModuleLabel->setAlignment( Qt::AlignVCenter ); //how to 'or' with Qt::TextWordWrap ??
	layoutVertical->addWidget( txtModuleLabel );
}
예제 #15
0
KFontChooser::KFontChooser( QWidget *parent, const char *name )
	: QWidget( parent, name )
{
	int i;
	
	fnt = QFont( "helvetica", 12 );
	changed = False;
	
	QBoxLayout *topLayout = new QVBoxLayout( this, 10, 5 );
	topLayout->addStretch( 5 );
	
	QBoxLayout *stackLayout = new QVBoxLayout( 4 );
	
	topLayout->addLayout( stackLayout );
		
	cmbFont = new QComboBox( false, this );
	cmbFont->setFixedHeight( cmbFont->sizeHint().height() );
	
	getFontList( fixedList, true );
	getFontList( fontList );
	
	cmbFont->insertStrList( &fontList );
	QStrListIterator it( fontList );
	for ( i = 0; it.current(); ++it, i++ ) {
		if ( !strcmp( fnt.family(), it.current() ) )
			cmbFont->setCurrentItem( i );
	}
	
	connect( cmbFont, SIGNAL( activated( const char * ) ),
		SLOT( slotSelectFont( const char * ) ) );
		
	QLabel *label = new QLabel( cmbFont, i18n("&Typeface"), this );
	label->adjustSize();
	label->setMinimumSize( label->size() );
	
	stackLayout->addWidget( label );
	stackLayout->addWidget( cmbFont );

	cbBold = new QCheckBox(  i18n("&Bold"), this );
	cbBold->setMinimumSize( cbBold->sizeHint() );
	cbBold->setChecked( fnt.bold() );
	connect( cbBold, SIGNAL( toggled( bool ) ), SLOT( slotFontBold( bool ) ) );
	
	topLayout->addWidget( cbBold );
	
	cbItalic = new QCheckBox(  i18n("&Italic"), this );
	cbItalic->setMinimumSize( cbItalic->sizeHint() );
	cbItalic->setChecked( fnt.italic() );
	connect( cbItalic, SIGNAL( toggled( bool ) ), SLOT( slotFontItalic( bool ) ) );
	
	topLayout->addWidget( cbItalic );
	
	QBoxLayout *pushLayout = new QHBoxLayout(  2 );
	
	topLayout->addLayout( pushLayout );
	
	stackLayout = new QVBoxLayout( 4 );
	
	pushLayout->addLayout( stackLayout, 10 );
	pushLayout->addSpacing( 10 );
	
	sbSize = new KNumericSpinBox( this );
	
	sbSize->setStep( 1 );
	sbSize->setRange( 8, 16 );
	sbSize->setValue( 12 );
	sbSize->adjustSize();

	connect( sbSize, SIGNAL( valueDecreased() ),
		 SLOT( slotFontSize() ) );
		 
	connect( sbSize, SIGNAL( valueIncreased() ),
		 SLOT( slotFontSize() ) );
	
	label = new QLabel( sbSize, i18n("&Size"), this );
	label->setMinimumSize( label->sizeHint() );

	cmbCharset = new QComboBox( false, this );
	
	cmbCharset->adjustSize();
	cmbCharset->setInsertionPolicy( QComboBox::NoInsertion );
	connect( cmbCharset, SIGNAL( activated( const char * ) ),
		 SLOT( slotCharset( const char * ) ) );
	
	sbSize->setFixedHeight( cmbCharset->height() );
	sbSize->setMinimumWidth(sbSize->width());
	cmbCharset->setFixedHeight( cmbCharset->height() );
	cmbCharset->setMinimumWidth( cmbCharset->width());

	stackLayout->addWidget( label );
	stackLayout->addWidget( sbSize );
	
	stackLayout = new QVBoxLayout( 4 );
	
	pushLayout->addLayout( stackLayout, 30 );
	
	label = new QLabel( cmbCharset, i18n("&Character set"), this );
	label->adjustSize();
	label->setMinimumSize( label->size() );
	
	stackLayout->addWidget( label );
	stackLayout->addWidget( cmbCharset );

	topLayout->activate();
	fillCharsetCombo();
}
예제 #16
0
파일: GUI.cpp 프로젝트: smistad/FAST
GUI::GUI() {
    mStreamingMode = STREAMING_MODE_STORE_ALL_FRAMES;
    QScreen* screen = QGuiApplication::primaryScreen();
    menuWidth = screen->geometry().width()*(1.0f/6.0f);
    mPipelineWidget = nullptr;
    mStreamer = ImageFileStreamer::New();

    QVBoxLayout* viewLayout = new QVBoxLayout;


    View* view = createView();
    view->set2DMode();
    view->setBackgroundColor(Color::Black());
    setWidth(screen->geometry().width());
    setHeight(screen->geometry().height());
    enableMaximized();
    setTitle("FAST - Viewer");
    viewLayout->addWidget(view);

    menuLayout = new QVBoxLayout;
    menuLayout->setAlignment(Qt::AlignTop);

    // Logo
    QImage* image = new QImage;
    image->load((Config::getDocumentationPath() + "images/FAST_logo_square.png").c_str());
    QLabel* logo = new QLabel;
    logo->setPixmap(QPixmap::fromImage(image->scaled(menuWidth, ((float)menuWidth/image->width())*image->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation)));
    logo->adjustSize();
    menuLayout->addWidget(logo);

    // Title label
    QLabel* title = new QLabel;
    title->setText("Viewer");
	QFont font;
	font.setPixelSize(24 * getScalingFactor());
	font.setWeight(QFont::Bold);
	title->setFont(font);
	title->setAlignment(Qt::AlignCenter);
    menuLayout->addWidget(title);

    // Quit button
    QPushButton* quitButton = new QPushButton;
    quitButton->setText("Quit (q)");
    quitButton->setStyleSheet("QPushButton { background-color: red; color: white; }");
    quitButton->setFixedWidth(menuWidth);
    menuLayout->addWidget(quitButton);

    // Connect the clicked signal of the quit button to the stop method for the window
    QObject::connect(quitButton, &QPushButton::clicked, std::bind(&Window::stop, this));

    QLabel* inputListLabel = new QLabel;
    //inputListLabel->setFixedHeight(24);
    inputListLabel->setText("Input data");
    inputListLabel->setStyleSheet("QLabel { font-weight: bold; }");
    menuLayout->addWidget(inputListLabel);

    mList = new QListWidget;
    mList->setFixedWidth(menuWidth);
    mList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    mList->setFixedHeight(200);
    mList->setSelectionMode(QAbstractItemView::ExtendedSelection); // Allow multiple items to be selected
    QObject::connect(mList, &QListWidget::itemSelectionChanged, std::bind(&GUI::selectInputData, this));
    menuLayout->addWidget(mList);

    QPushButton* addButton = new QPushButton;
    addButton->setText("Add input data");
    addButton->setFixedWidth(menuWidth);
    QObject::connect(addButton, &QPushButton::clicked, std::bind(&GUI::addInputData, this));
    menuLayout->addWidget(addButton);

    QLabel* selectPipelineLabel = new QLabel;
    selectPipelineLabel->setText("Active pipeline");
    selectPipelineLabel->setStyleSheet("QLabel { font-weight: bold; }");
    //selectPipelineLabel->setFixedHeight(24);
    menuLayout->addWidget(selectPipelineLabel);

    mSelectPipeline = new QComboBox;
    mSelectPipeline->setFixedWidth(menuWidth);
    mPipelines = getAvailablePipelines();
    int index = 0;
    int counter = 0;
    for(auto pipeline : mPipelines) {
        mSelectPipeline->addItem((pipeline.getName() + " (" + pipeline.getDescription() + ")").c_str());
        if(pipeline.getName() == "Image renderer") {
            index = counter;
        }
        ++counter;
    }
    mSelectPipeline->setCurrentIndex(index);

    menuLayout->addWidget(mSelectPipeline);
    QObject::connect(mSelectPipeline, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), std::bind(&GUI::selectPipeline, this));

    QPushButton* refreshPipeline = new QPushButton;
    refreshPipeline->setText("Refresh pipeline");
    refreshPipeline->setStyleSheet("QPushButton { background-color: blue; color: white; }");
    refreshPipeline->setFixedWidth(menuWidth);
    QObject::connect(refreshPipeline, &QPushButton::clicked, std::bind(&GUI::selectPipeline, this));
    menuLayout->addWidget(refreshPipeline);

    QPushButton* editPipeline = new QPushButton;
    editPipeline->setText("Edit pipeline");
    editPipeline->setStyleSheet("QPushButton { background-color: blue; color: white; }");
    editPipeline->setFixedWidth(menuWidth);
    QObject::connect(editPipeline, &QPushButton::clicked, std::bind(&GUI::editPipeline, this));
    menuLayout->addWidget(editPipeline);

    QPushButton* newPipeline = new QPushButton;
    newPipeline->setText("New pipeline");
    newPipeline->setStyleSheet("QPushButton { background-color: blue; color: white; }");
    newPipeline->setFixedWidth(menuWidth);
    QObject::connect(newPipeline, &QPushButton::clicked, std::bind(&GUI::newPipeline, this));
    menuLayout->addWidget(newPipeline);

    // Playback
    QHBoxLayout* playbackLayout = new QHBoxLayout;

    mPlayPauseButton = new QPushButton;
    mPlayPauseButton->setText("Play");
    mPlayPauseButton->setStyleSheet("QPushButton { background-color: green; color: white; }");
    //mPlayPauseButton->setFixedHeight(100);
    QObject::connect(mPlayPauseButton, &QPushButton::clicked, std::bind(&GUI::playPause, this));
    playbackLayout->addWidget(mPlayPauseButton);

    mTimestepSlider = new QSlider(Qt::Horizontal);
    // Improve style of slider
    mTimestepSlider->setStyleSheet("QSlider:horizontal { min-height: 50px; } QSlider::groove:horizontal {\n"
                                           "    border: 1px solid #999999;\n"
                                           "    height: 10px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */\n"
                                           "    background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);\n"
                                           "    margin: 2px 0;\n"
                                           "}\n"
                                           "\n"
                                           "QSlider::handle:horizontal {\n"
                                           "    background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #81BEF7, stop:1 #2E9AFE);\n"
                                           "    border: 1px solid #5c5c5c;\n"
                                           "    width: 18px;\n"
                                           "    height: 25px;\n"
                                           "    margin: -10px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */\n"
                                           "    border-radius: 3px;\n"
                                           "}");
    playbackLayout->addWidget(mTimestepSlider);
    mTimestepSlider->setTickPosition(QSlider::NoTicks);
    mTimestepSlider->setRange(0, 1234);
    mTimestepSlider->setPageStep(1);
    mTimestepSlider->setSingleStep(1);
    mTimestepSlider->setStyle(new MyStyle(mTimestepSlider->style())); // Fixes issues with direct jump with slider
    QObject::connect(mTimestepSlider, &QSlider::sliderMoved, std::bind(&GUI::setTimestep, this));
    QObject::connect(mTimestepSlider, &QSlider::sliderPressed, std::bind(&GUI::setTimestep, this));

    viewLayout->addLayout(playbackLayout);

    // Add menu and view to main layout
    QHBoxLayout* layout = new QHBoxLayout;
    layout->addLayout(menuLayout);
    layout->addLayout(viewLayout);

    mWidget->setLayout(layout);
	std::cout << "Finished viewer setup" << std::endl;

}
예제 #17
0
void KKbdAccessExtensions::displayAccessKeys()
{
    // Build a list of valid access keys that don't collide with shortcuts.
    QString availableAccessKeys = "ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890";
    QPtrList<KXMLGUIClient> allClients = d->mainWindow->factory()->clients();
    QPtrListIterator<KXMLGUIClient> it( allClients );
    KXMLGUIClient *client;
    while( (client=it.current()) !=0 )
    {
        ++it;
        KActionPtrList actions = client->actionCollection()->actions();
        for (int j = 0; j < (int)actions.count(); j++) {
            KAction* action = actions[j];
            KShortcut sc = action->shortcut();
            for (int i = 0; i < (int)sc.count(); i++) {
                KKeySequence seq = sc.seq(i);
                if (seq.count() == 1) {
                    QString s = seq.toString();
                    if (availableAccessKeys.contains(s))
                        availableAccessKeys.remove(s);
                }
            }
        }
    }
    // Find all visible, focusable widgets and create a QLabel for each.  Don't exceed
    // available list of access keys.
    QWidgetList* allWidgets = kapp->allWidgets();
    QWidget* widget = allWidgets->first();
    int accessCount = 0;
    int maxAccessCount = availableAccessKeys.length();
    int overlap = 20;
    QPoint prevGlobalPos = QPoint(-overlap, -overlap);
    while (widget && (accessCount < maxAccessCount)) {
        if (widget->isVisible() && widget->isFocusEnabled() ) {
            QRect r = widget->rect();
            QPoint p(r.x(), r.y());
            // Don't display an access key if within overlap pixels of previous one.
            QPoint globalPos = widget->mapToGlobal(p);
            QPoint diffPos = globalPos - prevGlobalPos;
            if (diffPos.manhattanLength() > overlap) {
                accessCount++;
                QLabel* lab=new QLabel(widget, "", widget, 0, Qt::WDestructiveClose);
                lab->setPalette(QToolTip::palette());
                lab->setLineWidth(2);
                lab->setFrameStyle(QFrame::Box | QFrame::Plain);
                lab->setMargin(3);
                lab->adjustSize();
                lab->move(p);
                if (!d->accessKeyLabels) {
                    d->accessKeyLabels = new QPtrList<QLabel>;
                    d->accessKeyLabels->setAutoDelete(true);
                }
                d->accessKeyLabels->append(lab);
                prevGlobalPos = globalPos;
            }
        }
        widget = allWidgets->next();
    }
    if (accessCount > 0) {
        // Sort the access keys from left to right and down the screen.
        QValueList<KSortedLabel> sortedLabels;
        for (int i = 0; i < accessCount; i++)
            sortedLabels.append(KSortedLabel(d->accessKeyLabels->at(i)));
        qHeapSort( sortedLabels );
        // Assign access key labels.
        for (int i = 0; i < accessCount; i++) {
            QLabel* lab = sortedLabels[i].label();
            QChar s = availableAccessKeys[i];
            lab->setText(s);
            lab->adjustSize();
            lab->show();
        }
    }
}
예제 #18
0
void InteractiveService::processCommand(int code)
{
    gui->setText("Command code " + QString::number(code));
    gui->adjustSize();
}
예제 #19
0
  /*
  Most important function of an interactor component
  When an event arrive on your interactor : this function is call
  You have to process it and return true. If the event do nothing in your interactor : this function
  return false;
  */
  bool eventFilter(QObject *, QEvent *e) {

    /*
    If you have clicked on a node/edge, information widget is visible.
    And if you use the wheel of the mouse we hide the information widget
    */
    if (_informationWidgetItem->isVisible() && e->type() == QEvent::Wheel) {
      _informationWidgetItem->setVisible(false);
      return false;
    }

    /*
    Check if the event is a mouse event
    */
    QMouseEvent *qMouseEv = dynamic_cast<QMouseEvent *>(e);

    if (qMouseEv != nullptr) {
      GlMainView *glMainView = static_cast<GlMainView *>(view());

      /*
      Check if event is a left mouse button press
      */
      if (e->type() == QEvent::MouseButtonPress && qMouseEv->button() == Qt::LeftButton) {

        /*
        If you have clicked on a node/edge, information widget is visible.
        And if you reclick : hide it
        */
        if (_informationWidgetItem->isVisible()) {
          _informationWidgetItem->setVisible(false);
        } else {

          /*
          Select entities under the mouse cursor
          The result of selection is stored in SelectedEntity
          And pickNodesEdges return true if you click on node or edge
          */
          SelectedEntity selectedEntity;

          if (glMainView->getGlMainWidget()->pickNodesEdges(qMouseEv->x(), qMouseEv->y(),
                                                            selectedEntity)) {

            /*
            Change text of the information label with
            - If you click on a node : "Click on node id : nodeId"
            - If you click on an edge : "Click on edge id : edgeId"
            */
            QString text("Click on ");

            if (selectedEntity.getEntityType() == SelectedEntity::NODE_SELECTED)
              text += "node ";
            else
              text += "edge ";

            text += " id : " + QString::number(selectedEntity.getComplexEntityId());

            /*
            - Update QLabel with new text
            - Auto resize QLabel
            - Set position of the label at mouse position
            - Display it
            */
            _informationLabel->setText(text);
            _informationLabel->adjustSize();
            _informationWidgetItem->setPos(qMouseEv->pos());
            _informationWidgetItem->setVisible(true);

            /*
            Here we just add a small smooth animation on the label pop
            */
            QPropertyAnimation *animation =
                new QPropertyAnimation(_informationWidgetItem, "opacity");
            animation->setDuration(100);
            animation->setStartValue(0.);
            animation->setEndValue(0.99);
            animation->start();

            /*
            We have treated the event so we return true
            */
            return true;
          }
        }
      }
    }

    /*
    We don't have treated the event se we return false
    */
    return false;
  }
void BuildFontDialog::pickLetter(const QPoint & p)
{ 
  if (selectionArbitrary->isChecked())
  {
    if(arbitraryLastPoint.x() < 0)
    {
      arbitraryLastPoint = p;
    }
    else
    {
      QRect rect(arbitraryLastPoint, p);
      if(rect.height() <= 0) rect.setHeight(10);
      if(rect.width() <= 0) rect.setWidth(10); //TODO Code smell!!
      QImage picked = originalPage.copy(rect);
      QLabel* label = radio2label[this->buttonGroup->checkedButton()]; //TODO duplicate code!!!
      label->setPixmap(QPixmap::fromImage(picked));
      label->adjustSize();
      FontLetterInfo info;
      info.img = QPixmap::fromImage(picked);
      info.topLeft = QPoint(-1,-picked.height()) ;
      info.width = info.img.width();
      char letter =  radioBtn2Char[(QRadioButton*)(this->buttonGroup->checkedButton())];
      builtFont[letter] = info;
      
      QRadioButton *next= (QRadioButton *)(this->buttonGroup->button(this->buttonGroup->id(this->buttonGroup->checkedButton())-1));
      if(next != NULL)
      {
        next->setChecked(true);
      }
      
      arbitraryLastPoint.setX(-1);
    }
    return;
  }
  for(int i = 0; i < letterRects.size(); i++)
  {
    QRect rect = letterRects[i];

    if(p.x() >= rect.left() && p.x() <= rect.right() && p.y() >= rect.top() && p.y() <= rect.bottom())
    {
      //qDebug() << "wrapped in" << p << rect;
      QImage picked = originalPage.copy(rect);
      QLabel* label = radio2label[this->buttonGroup->checkedButton()];
      label->setPixmap(QPixmap::fromImage(picked));
      label->adjustSize();
      
      
      
      int baseline = baselines[i]; //TODO : vulnerable!!!
      char letter =  radioBtn2Char[(QRadioButton*)(this->buttonGroup->checkedButton())];
      FontLetterInfo info;
      info.img = QPixmap::fromImage(picked);
      qDebug() << "baseline" << info.img.height() << baseline;
      info.topLeft = QPoint(-1,-baseline) ;
      info.width = info.img.width();
      builtFont[letter] = info;
      qDebug() << "add to map" << letter;
      
      
      QRadioButton *next= (QRadioButton *)(this->buttonGroup->button(this->buttonGroup->id(this->buttonGroup->checkedButton())-1));
      if(next != NULL)
      {
        next->setChecked(true);
      }
      
      break;
    }
  }
  
}
예제 #21
0
void BasicInfoRpt::initUI(const QString& titletext)
{
    this->setFixedSize(900, 600);

    QLabel* title = new QLabel(titletext, this);
    title->adjustSize();
    title->move(900 / 2 - title->width() / 2, 17);

    QLabel* icon = new QLabel(this);
    icon->setPixmap(QPixmap(":image/detailreport/logo"));
    icon->adjustSize();
    icon->move(900 / 2 - title->width() / 2 - 3 - icon->width(), 12);

    returnbtn = new StaticButton(":image/detailreport/returnbtn", 3, this);
    returnbtn->move(0, 0);

    osInfoBtn = new TaskButton(":image/detailreport/basicinfo/osInfoBtn", this);
    osInfoBtn->move(27, 60);
    cpuInfoBtn = new TaskButton(":image/detailreport/basicinfo/cpuInfoBtn", this);
    cpuInfoBtn->move(27 + 142, 60);
    biosInfoBtn = new TaskButton(":image/detailreport/basicinfo/biosInfoBtn", this);
    biosInfoBtn->move(27 + 142 * 2, 60);
    motherBoardInfoBtn = new TaskButton(":image/detailreport/basicinfo/motherBoardInfoBtn", this);
    motherBoardInfoBtn->move(27 + 142 * 3, 60);
    memoryInfoBtn = new TaskButton(":image/detailreport/basicinfo/memoryInfoBtn", this);
    memoryInfoBtn->move(27 + 142 * 4, 60);
    graphicsCardInfoBtn = new TaskButton(":image/detailreport/basicinfo/graphicsCardInfoBtn", this);
    graphicsCardInfoBtn->move(27 + 142 * 5, 60);

    taskbtnlist << osInfoBtn << cpuInfoBtn << biosInfoBtn << motherBoardInfoBtn << memoryInfoBtn << graphicsCardInfoBtn;

    for (TaskButton* task : taskbtnlist) {
        task->running_movie->move((task->running_defaultstatus->width()) / 2 - 10, 50);
    }
    osView = new QTableView(this);
    //hardDiskInfoView->setModel(hardDiskInfoMod);
    initViewDetail(osView);

    cpuInfoView = new QTableView(this);
    //virtualMachineInfoView->setModel(virtualMachineInfoMod);
    initViewDetail(cpuInfoView);

    biosInfoView = new QTableView(this);
    //netConfigView->setModel(netConfigMod);
    initViewDetail(biosInfoView);

    motherBoardInfoView = new QTableView(this);
    //adapterDeviceView->setModel(adapterDeviceMod);
    initViewDetail(motherBoardInfoView);

    memoryInfoView = new QTableView(this);
    //printDeviceView->setModel(printDeviceMod);
    initViewDetail(memoryInfoView);

    graphicsCardInfoView = new QTableView(this);
    //blueToothDeviceView->setModel(blueToothDeviceMod);
    initViewDetail(graphicsCardInfoView);
    //osView->setContextMenuPolicy(Qt::CustomContextMenu);
    //connect(osView, SIGNAL(customContextMenuRequested(const QPoint&)),
    //        SLOT(showFileCheckContextMenu(const QPoint&)));
    viewlist << osView << cpuInfoView << biosInfoView
             << motherBoardInfoView << memoryInfoView << graphicsCardInfoView;

    contextmenu = new QMenu(this);
    openfile = new QAction("打开文件", contextmenu);
    connect(openfile, &QAction::triggered,
            [=]() {
        QStringList argo;
        QProcess* exec ;
        exec = new QProcess();
        argo << "xdg-open"
             << openfile->data().toString();
        exec->start("/bin/bash", argo);
        connect(exec, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this,
                [=](int exitCode) {
            qDebug()<<exitCode;
         delete exec;

        });
    });
    openfilepath = new QAction("打开文件所在文件夹", contextmenu);
    connect(openfilepath, &QAction::triggered,
            [=]() {
        QStringList argo;
        QProcess* exec ;
        exec = new QProcess();
        argo << "xdg-open"
             << openfilepath->data().toString();
        exec->start("/bin/bash", argo);
        connect(exec, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this,
                [=](int exitCode) {
         delete exec;
         qDebug()<<exitCode;
        });
    });
    contextmenu->addAction(openfile);
    contextmenu->addAction(openfilepath);

}
예제 #22
0
PasswordDialog::PasswordDialog(const char *head, QWidget* parent, const char* name, bool modal, WFlags wflags)
   : QDialog(parent, name, modal, wflags)
{
    debugT("Here we go!!\n");
    
   _head = head;

   // (David) Layout management
   QVBoxLayout *vLay = new QVBoxLayout(this, 10 /* border */, 5);

   //
   // Bei Bedarf einen kleinen Kommentar als Label einfuegen
   // English please !!! David.
   if (_head)
   {
      QLabel *l;
      
      l = new QLabel(_head, this);
      l->adjustSize();
      l->setMinimumSize(l->size());
      vLay->addWidget(l);
      // l->setGeometry( 10, 10, 200, 20 );
   }

   // The horizontal layout for label + lineedit
   QHBoxLayout *hLay = new QHBoxLayout(5);
   vLay->addLayout(hLay);
   //
   // Die eine oder zwei Zeile(n) mit der Passwortabfrage
   //
   QLabel *l_password = new QLabel(klocale->translate("Password"), this);
   l_password->adjustSize();
   l_password->setMinimumSize(l_password->size());
   hLay->addWidget(l_password,0);
   //l_password->setGeometry( 10, 40, 80, 30 );
   
   _w_password = new QLineEdit( this );
   //_w_password->setGeometry( 90, 40, 100, 30 );
   _w_password->setEchoMode( QLineEdit::Password );
   _w_password->adjustSize();
   _w_password->setFixedHeight(_w_password->height());
   hLay->addWidget(_w_password,10);
   
   //
   // Connect vom LineEdit herstellen und Accelerator
   //
   QAccel *ac = new QAccel(this);
   ac->connectItem( ac->insertItem(Key_Escape), this, SLOT(reject()) );
   
   connect( _w_password, SIGNAL(returnPressed()), SLOT(accept()) );
   
   //
   // Eine vertikale Linie erzeugen
   //
   QFrame *f = new QFrame(this);
   f->setLineWidth(1);
   f->setMidLineWidth(1);
   f->setFrameStyle( QFrame::HLine|QFrame::Raised);
   //f->setGeometry( 10, 80, 180, 2 );
   f->setMinimumHeight(5);
   vLay->addWidget(f,0);
   
   //
   // Die Buttons "OK" & "Cancel" erzeugen
   //
   QHBoxLayout *hBLay = new QHBoxLayout(5);
   vLay->addLayout(hBLay);

   hBLay->addStretch();

   QPushButton *b1, *b2;
   b1 = new QPushButton(klocale->translate("OK"), this);
   //b1->setGeometry( 10, 90, 80, 30 );
   b1->adjustSize();
   b1->setFixedSize(b1->size());   
   hBLay->addWidget(b1);

   hBLay->addStretch();
   //or hBLay->addSpacing(10);
   
   b2 = new QPushButton(klocale->translate("Cancel"), this);
   //b2->setGeometry( 110, 90, 80, 30 );
   b2->adjustSize();
   b2->setFixedSize(b2->size());   
   hBLay->addWidget(b2);

   hBLay->addStretch();
   
   // Buttons mit Funktionaliataet belegen
   connect( b1, SIGNAL(clicked()), SLOT(accept()) );
   connect( b2, SIGNAL(clicked()), SLOT(reject()) );
   
   // Fenstertitel
   setCaption(klocale->translate("Password"));
   
   // Focus
   _w_password->setFocus();
   
   vLay->activate();
   setMinimumSize(200, 50);
   setMaximumSize(300, 100);

   debugT("Hi folks, thats it\n");
}
예제 #23
0
//-----------------------------------------------------------------------------
KMFolderDialog::KMFolderDialog(KMFolder* aFolder, QWidget *parent,
			       const char *name) :
  KMFolderDialogInherited(parent, name, TRUE)
{
  KMAccount* acct;
  QLabel *label;
  QString type;

  folder = (KMAcctFolder*)aFolder;

  label = new QLabel(this);
  label->setGeometry(20,20,60,25);
  label->setText(i18n("Name:"));
  label->setAlignment(290);

  nameEdit = new QLineEdit(this);
  nameEdit->setGeometry(90,20,320,25);
  nameEdit->setFocus();
  nameEdit->setText(folder ? folder->name().data() : i18n("unnamed"));

  if (folder)
  {
    type = folder->type();
    if (!type.isEmpty() && type!="plain")
      nameEdit->setEnabled(false);
  }

  label = new QLabel(this);
  label->setText(i18n("Associated with"));
  label->adjustSize();
  label->move(20,74);

  assocList = new QListBox(this);
  assocList->setGeometry(20,95,160,140);
  connect(assocList,SIGNAL(highlighted(int)),this,SLOT(doAssocHighlighted(int)));
  connect(assocList,SIGNAL(selected(int)),this,SLOT(doAssocSelected(int)));

  label = new QLabel(this);
  label->setText(i18n("Unassociated Accounts"));
  label->adjustSize();
  label->move(250,74);

  accountList = new QListBox(this);
  accountList->setGeometry(250,95,160,140);
  connect(accountList,SIGNAL(highlighted(int)),this,SLOT(doAccountHighlighted(int)));
  connect(accountList,SIGNAL(selected(int)),this,SLOT(doAccountSelected(int)));

  addButton = new QPushButton(this);
  addButton->setGeometry(190,115,50,40);
  addButton->setText("<<");
  addButton->setEnabled(FALSE);
  connect(addButton,SIGNAL(clicked()),this,SLOT(doAdd()));

  removeButton = new QPushButton(this);
  removeButton->setGeometry(190,175,50,40);
  removeButton->setText(">>");
  removeButton->setEnabled(FALSE);
  connect(removeButton,SIGNAL(clicked()),this,SLOT(doRemove()));

  QPushButton *button = new QPushButton(this);
  button->setGeometry(190,260,100,30);
  button->setText(i18n("OK"));
  connect(button,SIGNAL(clicked()),this,SLOT(doAccept()));

  if (type=="Out" || type=="St")
    button->setEnabled(false);

  button = new QPushButton(this);
  button->setGeometry(310,260,100,30);
  button->setText(i18n("Cancel"));
  connect(button,SIGNAL(clicked()),this,SLOT(reject()));

  resize(430,340);
  setFixedSize(430,340);

  if (folder)
  {
    // Grab the list of accounts associated with the given folder.
    for (acct=folder->account(); acct; acct=folder->nextAccount())
    {
      assocList->inSort(acct->name());
    }
  }

  // insert list of available accounts that are not associated with
  // any account
  for (acct=acctMgr->first(); acct; acct=acctMgr->next())
  {
    if (!acct->folder())
      accountList->inSort(acct->name());
  }
}