Beispiel #1
0
void JabberAddAccountWidget::createGui(bool showButtons)
{
  	QVBoxLayout *mainLayout = new QVBoxLayout(this);

	QWidget *formWidget = new QWidget(this);
	mainLayout->addWidget(formWidget);

	QFormLayout *layout = new QFormLayout(formWidget);

	QWidget *jidWidget = new QWidget(this);
	QGridLayout *jidLayout = new QGridLayout(jidWidget);
	jidLayout->setSpacing(0);
	jidLayout->setMargin(0);
	jidLayout->setColumnStretch(0, 2);
	jidLayout->setColumnStretch(2, 2);

	Username = new QLineEdit(this);
	connect(Username, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	jidLayout->addWidget(Username);

	AtLabel = new QLabel("@", this);
	jidLayout->addWidget(AtLabel, 0, 1);

	Domain = new QComboBox();
	Domain->setEditable(true);
	connect(Domain, SIGNAL(currentIndexChanged(QString)), this, SLOT(dataChanged()));
	connect(Domain, SIGNAL(editTextChanged(QString)), this, SLOT(dataChanged()));
	jidLayout->addWidget(Domain, 0, 2);

	layout->addRow(tr("Username") + ':', jidWidget);

	AccountPassword = new QLineEdit(this);
	connect(AccountPassword, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	AccountPassword->setEchoMode(QLineEdit::Password);
	layout->addRow(tr("Password") + ':', AccountPassword);

	RememberPassword = new QCheckBox(tr("Remember Password"), this);
	layout->addRow(0, RememberPassword);

	Identity = m_pluginInjectedFactory->makeInjected<IdentitiesComboBox>(this);
	connect(Identity, SIGNAL(currentIndexChanged(int)), this, SLOT(dataChanged()));
	layout->addRow(tr("Account Identity") + ':', Identity);

	QLabel *infoLabel = new QLabel(tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"), this);
	infoLabel->setWordWrap(true);
	infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
	infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
	layout->addRow(0, infoLabel);

	mainLayout->addStretch(100);

	QDialogButtonBox *buttons = new QDialogButtonBox(Qt::Horizontal, this);
	mainLayout->addWidget(buttons);

	AddAccountButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Add Account"), this);
	QPushButton *cancelButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);

	buttons->addButton(AddAccountButton, QDialogButtonBox::AcceptRole);
	buttons->addButton(cancelButton, QDialogButtonBox::DestructiveRole);

	connect(AddAccountButton, SIGNAL(clicked(bool)), this, SLOT(apply()));
	connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancel()));

	if (!showButtons)
		buttons->hide();
}
Beispiel #2
0
void toResultDataSingle::changeSource(toResultModelEdit *model, int _row)
{
    delete Container;
    Container = new QScrollArea(this);
    layout()->addWidget(Container);

    Model = model;
    ProgressBar->setMaximum(Model->rowCount());
    ProgressBar->setValue(_row);

    QWidget *ext = new QWidget(Container);
    Container->setWidget(ext);
    Container->setWidgetResizable(true);

    QGridLayout *grid = new QGridLayout;
    ext->setLayout(grid);

    Value.clear();
    Null.clear();

    const toResultModel::HeaderList Headers = Model->headers();

    int row = 1 + Model->getPriKeys().size();
    int col = 0;

    for (; row < Headers.size(); row++, col = 0)
    {
        QLabel *name = new QLabel(Headers[row].name, this);
        grid->addWidget(name, row, col++);

        QLineEdit *edit = new QLineEdit(this);
        edit->setObjectName(QString::number(row));
        edit->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,
                                        QSizePolicy::Minimum));
        grid->addWidget(edit, row, col);
        // edit widget should get the most space
        grid->setColumnStretch(col++, 1);

        QCheckBox *box = new QCheckBox(("NULL"), this);
        connect(box, SIGNAL(toggled(bool)), edit, SLOT(setDisabled(bool)));
        grid->addWidget(box, row, col++);

        toParamGetButton *btn = new toParamGetButton(row, this);
        btn->setText(tr("Edit"));
        btn->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed));
        connect(btn, SIGNAL(clicked(int)), this, SLOT(showMemo(int)));
        connect(box, SIGNAL(toggled(bool)), btn, SLOT(setDisabled(bool)));
        connect(box, SIGNAL(toggled(bool)), this, SLOT(saveRow()));
        connect(edit, SIGNAL(editingFinished()), this, SLOT(saveRow()));
        grid->addWidget(btn, row, col++);

        Value.append(edit);
        Null.append(box);
    }

    // add widget at bottom of grid so it can resize
    grid->addWidget(new QLabel(this), row, 0);
    grid->setRowStretch(row, 1);

    changeRow(Row);

    connect(Model,
            SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
            this,
            SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
}
/*
 *  Constructs a CuteCommDlg as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
CuteCommDlg::CuteCommDlg( QWidget* parent, const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    if ( !name )
	setName( "CuteCommDlg" );
    CuteCommDlgLayout = new QVBoxLayout( this, 11, 6, "CuteCommDlgLayout"); 

    layout11 = new QGridLayout( 0, 1, 1, 0, 6, "layout11"); 

    textLabel5 = new QLabel( this, "textLabel5" );

    layout11->addWidget( textLabel5, 3, 1 );

    m_quitPb = new QPushButton( this, "m_quitPb" );

    layout11->addWidget( m_quitPb, 3, 0 );

    textLabel3 = new QLabel( this, "textLabel3" );

    layout11->addWidget( textLabel3, 2, 1 );

    m_aboutPb = new QPushButton( this, "m_aboutPb" );

    layout11->addWidget( m_aboutPb, 2, 0 );

    m_dataBitsCb = new QComboBox( FALSE, this, "m_dataBitsCb" );

    layout11->addWidget( m_dataBitsCb, 2, 2 );

    textLabel1 = new QLabel( this, "textLabel1" );

    layout11->addWidget( textLabel1, 0, 1 );

    m_connectPb = new QPushButton( this, "m_connectPb" );

    layout11->addWidget( m_connectPb, 0, 0 );

    m_closePb = new QPushButton( this, "m_closePb" );

    layout11->addWidget( m_closePb, 1, 0 );

    m_stopCb = new QComboBox( FALSE, this, "m_stopCb" );

    layout11->addWidget( m_stopCb, 3, 2 );

    textLabel2 = new QLabel( this, "textLabel2" );

    layout11->addWidget( textLabel2, 1, 1 );

    m_deviceCb = new QComboBox( FALSE, this, "m_deviceCb" );
    m_deviceCb->setEditable( TRUE );

    layout11->addWidget( m_deviceCb, 0, 2 );

    m_baudCb = new QComboBox( FALSE, this, "m_baudCb" );

    layout11->addWidget( m_baudCb, 1, 2 );

    layout10 = new QVBoxLayout( 0, 0, 6, "layout10"); 

    layout9 = new QHBoxLayout( 0, 0, 6, "layout9"); 

    textLabel4 = new QLabel( this, "textLabel4" );
    layout9->addWidget( textLabel4 );

    m_parityCb = new QComboBox( FALSE, this, "m_parityCb" );
    layout9->addWidget( m_parityCb );
    layout10->addLayout( layout9 );

    layout9_2 = new QGridLayout( 0, 1, 1, 0, 6, "layout9_2"); 

    m_hardwareCb = new QCheckBox( this, "m_hardwareCb" );

    layout9_2->addWidget( m_hardwareCb, 0, 2 );

    m_softwareCb = new QCheckBox( this, "m_softwareCb" );

    layout9_2->addWidget( m_softwareCb, 0, 1 );

    m_writeCb = new QCheckBox( this, "m_writeCb" );

    layout9_2->addWidget( m_writeCb, 1, 2 );

    m_readCb = new QCheckBox( this, "m_readCb" );

    layout9_2->addWidget( m_readCb, 1, 1 );

    textLabel1_3 = new QLabel( this, "textLabel1_3" );

    layout9_2->addWidget( textLabel1_3, 1, 0 );

    textLabel2_2 = new QLabel( this, "textLabel2_2" );

    layout9_2->addWidget( textLabel2_2, 0, 0 );
    layout10->addLayout( layout9_2 );

    m_applyCb = new QCheckBox( this, "m_applyCb" );
    layout10->addWidget( m_applyCb );

    layout11->addMultiCellLayout( layout10, 0, 3, 3, 3 );
    CuteCommDlgLayout->addLayout( layout11 );

    splitter2 = new QSplitter( this, "splitter2" );
    splitter2->setOrientation( QSplitter::Vertical );

    frame3 = new QFrame( splitter2, "frame3" );
    frame3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 2, frame3->sizePolicy().hasHeightForWidth() ) );
    frame3->setFrameShape( QFrame::StyledPanel );
    frame3->setFrameShadow( QFrame::Raised );
    frame3Layout = new QVBoxLayout( frame3, 11, 6, "frame3Layout"); 

    m_outputView = new QTextBrowser( frame3, "m_outputView" );
    QFont m_outputView_font(  m_outputView->font() );
    m_outputView_font.setFamily( "Courier" );
    m_outputView->setFont( m_outputView_font ); 
    m_outputView->setTextFormat( QTextBrowser::PlainText );
    m_outputView->setWrapPolicy( QTextBrowser::Anywhere );
    frame3Layout->addWidget( m_outputView );

    layout10_2 = new QHBoxLayout( 0, 0, 6, "layout10_2"); 

    m_clearOutputPb = new QPushButton( frame3, "m_clearOutputPb" );
    layout10_2->addWidget( m_clearOutputPb );

    m_hexOutputCb = new QCheckBox( frame3, "m_hexOutputCb" );
    m_hexOutputCb->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 1, 0, m_hexOutputCb->sizePolicy().hasHeightForWidth() ) );
    layout10_2->addWidget( m_hexOutputCb );

    m_enableLoggingCb = new QCheckBox( frame3, "m_enableLoggingCb" );
    layout10_2->addWidget( m_enableLoggingCb );

    m_logAppendCb = new QComboBox( FALSE, frame3, "m_logAppendCb" );
    layout10_2->addWidget( m_logAppendCb );

    m_logFileLe = new QLineEdit( frame3, "m_logFileLe" );
    m_logFileLe->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 2, 0, m_logFileLe->sizePolicy().hasHeightForWidth() ) );
    layout10_2->addWidget( m_logFileLe );

    m_logFileFileDialog = new QPushButton( frame3, "m_logFileFileDialog" );
    layout10_2->addWidget( m_logFileFileDialog );
    frame3Layout->addLayout( layout10_2 );

    frame4 = new QFrame( splitter2, "frame4" );
    frame4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 1, frame4->sizePolicy().hasHeightForWidth() ) );
    frame4->setFrameShape( QFrame::StyledPanel );
    frame4->setFrameShadow( QFrame::Raised );
    frame4Layout = new QVBoxLayout( frame4, 11, 6, "frame4Layout"); 

    m_oldCmdsLb = new QListBox( frame4, "m_oldCmdsLb" );
    m_oldCmdsLb->setFocusPolicy( QListBox::NoFocus );
    frame4Layout->addWidget( m_oldCmdsLb );

    layout9_3 = new QHBoxLayout( 0, 0, 6, "layout9_3"); 

    textLabel1_2 = new QLabel( frame4, "textLabel1_2" );
    layout9_3->addWidget( textLabel1_2 );

    m_cmdLe = new QLineEdit( frame4, "m_cmdLe" );
    layout9_3->addWidget( m_cmdLe );
    frame4Layout->addLayout( layout9_3 );

    layout10_3 = new QHBoxLayout( 0, 0, 6, "layout10_3"); 

    m_sendPb = new QPushButton( frame4, "m_sendPb" );
    m_sendPb->setAutoDefault( FALSE );
    layout10_3->addWidget( m_sendPb );

    m_protoPb = new QComboBox( FALSE, frame4, "m_protoPb" );
    layout10_3->addWidget( m_protoPb );
    spacer3 = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout10_3->addItem( spacer3 );

    m_inputModeCb = new QComboBox( FALSE, frame4, "m_inputModeCb" );
    layout10_3->addWidget( m_inputModeCb );

    textLabel1_4 = new QLabel( frame4, "textLabel1_4" );
    layout10_3->addWidget( textLabel1_4 );

    m_charDelaySb = new QSpinBox( frame4, "m_charDelaySb" );
    m_charDelaySb->setMaxValue( 250 );
    m_charDelaySb->setValue( 1 );
    layout10_3->addWidget( m_charDelaySb );
    frame4Layout->addLayout( layout10_3 );
    CuteCommDlgLayout->addWidget( splitter2 );
    languageChange();
    resize( QSize(756, 648).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // tab order
    setTabOrder( m_connectPb, m_aboutPb );
    setTabOrder( m_aboutPb, m_quitPb );
    setTabOrder( m_quitPb, m_deviceCb );
    setTabOrder( m_deviceCb, m_baudCb );
    setTabOrder( m_baudCb, m_dataBitsCb );
    setTabOrder( m_dataBitsCb, m_stopCb );
    setTabOrder( m_stopCb, m_parityCb );
    setTabOrder( m_parityCb, m_softwareCb );
    setTabOrder( m_softwareCb, m_hardwareCb );
    setTabOrder( m_hardwareCb, m_readCb );
    setTabOrder( m_readCb, m_writeCb );
    setTabOrder( m_writeCb, m_applyCb );
    setTabOrder( m_applyCb, m_outputView );
    setTabOrder( m_outputView, m_clearOutputPb );
    setTabOrder( m_clearOutputPb, m_hexOutputCb );
    setTabOrder( m_hexOutputCb, m_cmdLe );
    setTabOrder( m_cmdLe, m_inputModeCb );
    setTabOrder( m_inputModeCb, m_sendPb );
    setTabOrder( m_sendPb, m_protoPb );
    setTabOrder( m_protoPb, m_closePb );

    // buddies
    textLabel5->setBuddy( m_stopCb );
    textLabel3->setBuddy( m_dataBitsCb );
    textLabel1->setBuddy( m_deviceCb );
    textLabel2->setBuddy( m_baudCb );
    textLabel4->setBuddy( m_parityCb );
    textLabel1_2->setBuddy( m_cmdLe );
}
void QtGroupBoxPropertyBrowserPrivate::propertyInserted(QtBrowserItem *index, QtBrowserItem *afterIndex)
{
    WidgetItem *afterItem = m_indexToItem.value(afterIndex);
    WidgetItem *parentItem = m_indexToItem.value(index->parent());

    WidgetItem *newItem = new WidgetItem();
    newItem->parent = parentItem;

    QGridLayout *layout = 0;
    QWidget *parentWidget = 0;
    int row = -1;
    if (!afterItem) {
        row = 0;
        if (parentItem)
            parentItem->children.insert(0, newItem);
        else
            m_children.insert(0, newItem);
    } else {
        if (parentItem) {
            row = parentItem->children.indexOf(afterItem) + 1;
            parentItem->children.insert(row, newItem);
        } else {
            row = m_children.indexOf(afterItem) + 1;
            m_children.insert(row, newItem);
        }
    }
    if (parentItem && hasHeader(parentItem))
        row += 2;

    if (!parentItem) {
        layout = m_mainLayout;
        parentWidget = q_ptr;;
    } else {
        if (!parentItem->groupBox) {
            m_recreateQueue.removeAll(parentItem);
            WidgetItem *par = parentItem->parent;
            QWidget *w = 0;
            QGridLayout *l = 0;
            int oldRow = -1;
            if (!par) {
                w = q_ptr;
                l = m_mainLayout;
                oldRow = m_children.indexOf(parentItem);
            } else {
                w = par->groupBox;
                l = par->layout;
                oldRow = par->children.indexOf(parentItem);
                if (hasHeader(par))
                    oldRow += 2;
            }
            parentItem->groupBox = new QGroupBox(w);
            parentItem->layout = new QGridLayout();
            parentItem->groupBox->setLayout(parentItem->layout);
            if (parentItem->label) {
                l->removeWidget(parentItem->label);
                delete parentItem->label;
                parentItem->label = 0;
            }
            if (parentItem->widget) {
                l->removeWidget(parentItem->widget);
                parentItem->widget->setParent(parentItem->groupBox);
                parentItem->layout->addWidget(parentItem->widget, 0, 0, 1, 2);
                parentItem->line = new QFrame(parentItem->groupBox);
            } else if (parentItem->widgetLabel) {
                l->removeWidget(parentItem->widgetLabel);
                delete parentItem->widgetLabel;
                parentItem->widgetLabel = 0;
            }
            if (parentItem->line) {
                parentItem->line->setFrameShape(QFrame::HLine);
                parentItem->line->setFrameShadow(QFrame::Sunken);
                parentItem->layout->addWidget(parentItem->line, 1, 0, 1, 2);
            }
            l->addWidget(parentItem->groupBox, oldRow, 0, 1, 2);
            updateItem(parentItem);
        }
        layout = parentItem->layout;
        parentWidget = parentItem->groupBox;
    }

    newItem->label = new QLabel(parentWidget);
    newItem->label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    newItem->widget = createEditor(index->property(), parentWidget);
    if (!newItem->widget) {
        newItem->widgetLabel = new QLabel(parentWidget);
        newItem->widgetLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
        newItem->widgetLabel->setTextFormat(Qt::PlainText);
    } else {
        QObject::connect(newItem->widget, SIGNAL(destroyed()), q_ptr, SLOT(slotEditorDestroyed()));
        m_widgetToItem[newItem->widget] = newItem;
    }

    insertRow(layout, row);
    int span = 1;
    if (newItem->widget)
        layout->addWidget(newItem->widget, row, 1);
    else if (newItem->widgetLabel)
        layout->addWidget(newItem->widgetLabel, row, 1);
    else
        span = 2;
    layout->addWidget(newItem->label, row, 0, 1, span);

    m_itemToIndex[newItem] = index;
    m_indexToItem[index] = newItem;

    updateItem(newItem);
}
Beispiel #5
0
QSizePolicy EditSvcPerms::sizePolicy() const
{
  return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
 IconButton(const QString& path, QWidget*parent = 0) : QPushButton(QIcon(path), "", parent) {
   setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
   setParent(parent);
   setFixedSize(QSize(24, 24));
 }
Beispiel #7
0
void Container::init()
{
	if (m_bInit)
		return;

    QFrame *frm = new QFrame(this, "container");
    setCentralWidget(frm);

    connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged()));

    QVBoxLayout *lay = new QVBoxLayout(frm);
    m_wnds = new QWidgetStack(frm);
    m_wnds->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    lay->addWidget(m_wnds);

    m_tabSplitter = new Splitter(frm);
    m_tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    m_tabBar = new UserTabBar(m_tabSplitter);
    m_tabBar->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding));
    m_tabBar->hide();

    m_bInit = true;

    m_status = new ContainerStatus(m_tabSplitter);
    lay->addWidget(m_tabSplitter);
    connect(m_tabBar, SIGNAL(selected(int)), this, SLOT(contactSelected(int)));
    connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolbarChanged(QToolBar*)));
    connect(m_status, SIGNAL(sizeChanged(int)), this, SLOT(statusChanged(int)));
    m_accel = new QAccel(this);
    connect(m_accel, SIGNAL(activated(int)), this, SLOT(accelActivated(int)));
    setupAccel();
    showBar();

	for (list<UserWnd*>::iterator it = m_childs.begin(); it != m_childs.end(); ++it)
		addUserWnd((*it), false);
	m_childs.clear();

    string windows = getWindows();
    while (!windows.empty()){
        unsigned long id = strtoul(getToken(windows, ',').c_str(), NULL, 10);
        Contact *contact = getContacts()->contact(id);
        if (contact == NULL)
            continue;
        Buffer config;
        const char *cfg = getWndConfig(id);
        if (cfg && *cfg){
            config << "[Title]\n" << cfg;
            config.setWritePos(0);
            config.getSection();
        }
        addUserWnd(new UserWnd(id, &config, false, true), true);
    }

    if (m_tabBar->count() == 0)
        QTimer::singleShot(0, this, SLOT(close()));
    setWindows(NULL);
    clearWndConfig();
    m_tabBar->raiseTab(getActiveWindow());

    show();
}
QSizePolicy RDAudioSettingsDialog::sizePolicy() const
{
  return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
Beispiel #9
0
void QDockArea::moveDockWindow( QDockWindow *w, const QPoint &p, const QRect &r, bool swap )
{
    invalidateFixedSizes();
    int mse = -10;
    bool hasResizable = FALSE;
    for ( QDockWindow *dw = dockWindows->first(); dw; dw = dockWindows->next() ) {
	if ( dw->isHidden() )
	    continue;
	if ( dw->isResizeEnabled() )
	    hasResizable = TRUE;
	if ( orientation() != Qt::Horizontal )
	    mse = QMAX( QMAX( dw->fixedExtent().width(), dw->width() ), mse );
	else
	    mse = QMAX( QMAX( dw->fixedExtent().height(), dw->height() ), mse );
    }
    if ( !hasResizable && w->isResizeEnabled() ) {
	if ( orientation() != Qt::Horizontal )
	    mse = QMAX( w->fixedExtent().width(), mse );
	else
	    mse = QMAX( w->fixedExtent().height(), mse );
    }

    QDockWindow *dockWindow = 0;
    int dockWindowIndex = findDockWindow( w );
    QPtrList<QDockWindow> lineStarts = layout->lineStarts();
    QValueList<QRect> lines = layout->lineList();
    bool wasAloneInLine = FALSE;
    QPoint pos = mapFromGlobal( p );
    QRect lr = *lines.at( lineOf( dockWindowIndex ) );
    if ( dockWindowIndex != -1 ) {
	if ( lineStarts.find( w ) != -1 &&
	     ( dockWindowIndex < (int)dockWindows->count() - 1 && lineStarts.find( dockWindows->at( dockWindowIndex + 1 ) ) != -1 ||
	       dockWindowIndex == (int)dockWindows->count() - 1 ) )
	    wasAloneInLine = TRUE;
	dockWindow = dockWindows->take( dockWindowIndex );
	if ( !wasAloneInLine ) { // only do the pre-layout if the widget isn't the only one in its line
	    if ( lineStarts.findRef( dockWindow ) != -1 && dockWindowIndex < (int)dockWindows->count() )
		dockWindows->at( dockWindowIndex )->setNewLine( TRUE );
	    layout->layoutItems( QRect( 0, 0, width(), height() ), TRUE );
	}
    } else {
	dockWindow = w;
	dockWindow->reparent( this, QPoint( 0, 0 ), TRUE );
	if ( swap )
	    dockWindow->resize( dockWindow->height(), dockWindow->width() );
	w->installEventFilter( this );
    }

    lineStarts = layout->lineStarts();
    lines = layout->lineList();

    QRect rect = QRect( mapFromGlobal( r.topLeft() ), r.size() );
    if ( orientation() == Horizontal && QApplication::reverseLayout() ) {
	rect = QRect( width() - rect.x() - rect.width(), rect.y(), rect.width(), rect.height() );
	pos.rx() = width() - pos.x();
    }
    dockWindow->setOffset( point_pos( rect.topLeft(), orientation() ) );
    if ( orientation() == Horizontal ) {
	int offs = dockWindow->offset();
	if ( width() - offs < dockWindow->minimumWidth() )
	    dockWindow->setOffset( width() - dockWindow->minimumWidth() );
    } else {
	int offs = dockWindow->offset();
	if ( height() - offs < dockWindow->minimumHeight() )
	    dockWindow->setOffset( height() - dockWindow->minimumHeight() );
    }

    if ( dockWindows->isEmpty() ) {
	dockWindows->append( dockWindow );
    } else {
	int dockLine = -1;
	bool insertLine = FALSE;
	int i = 0;
	QRect lineRect;
	// find the line which we touched with the mouse
	for ( QValueList<QRect>::Iterator it = lines.begin(); it != lines.end(); ++it, ++i ) {
	    if ( point_pos( pos, orientation(), TRUE ) >= point_pos( (*it).topLeft(), orientation(), TRUE ) &&
		 point_pos( pos, orientation(), TRUE ) <= point_pos( (*it).topLeft(), orientation(), TRUE ) +
		 size_extent( (*it).size(), orientation(), TRUE ) ) {
		dockLine = i;
		lineRect = *it;
		break;
	    }
	}
	if ( dockLine == -1 ) { // outside the dock...
	    insertLine = TRUE;
	    if ( point_pos( pos, orientation(), TRUE ) < 0 ) // insert as first line
		dockLine = 0;
	    else
		dockLine = (int)lines.count(); // insert after the last line ### size_t/int cast
	} else { // inside the dock (we have found a dockLine)
	    if ( point_pos( pos, orientation(), TRUE ) <
		 point_pos( lineRect.topLeft(), orientation(), TRUE ) + 4 ) {	// mouse was at the very beginning of the line
		insertLine = TRUE;					// insert a new line before that with the docking widget
	    } else if ( point_pos( pos, orientation(), TRUE ) >
			point_pos( lineRect.topLeft(), orientation(), TRUE ) +
			size_extent( lineRect.size(), orientation(), TRUE ) - 4 ) {	// mouse was at the very and of the line
		insertLine = TRUE;						// insert a line after that with the docking widget
		dockLine++;
	    }
	}

	if ( !insertLine && wasAloneInLine && lr.contains( pos ) ) // if we are alone in a line and just moved in there, re-insert it
	    insertLine = TRUE;

#if defined(QDOCKAREA_DEBUG)
	qDebug( "insert in line %d, and insert that line: %d", dockLine, insertLine );
	qDebug( "     (btw, we have %d lines)", lines.count() );
#endif
	QDockWindow *dw = 0;
	if ( dockLine >= (int)lines.count() ) { // insert after last line
	    dockWindows->append( dockWindow );
	    dockWindow->setNewLine( TRUE );
#if defined(QDOCKAREA_DEBUG)
	    qDebug( "insert at the end" );
#endif
	} else if ( dockLine == 0 && insertLine ) { // insert before first line
	    dockWindows->insert( 0, dockWindow );
	    dockWindows->at( 1 )->setNewLine( TRUE );
#if defined(QDOCKAREA_DEBUG)
	    qDebug( "insert at the begin" );
#endif
	} else { // insert somewhere in between
	    // make sure each line start has a new line
	    for ( dw = lineStarts.first(); dw; dw = lineStarts.next() )
		dw->setNewLine( TRUE );

	    // find the index of the first widget in the search line
	    int searchLine = dockLine;
#if defined(QDOCKAREA_DEBUG)
	    qDebug( "search line start of %d", searchLine );
#endif
	    QDockWindow *lsw = lineStarts.at( searchLine );
	    int index = dockWindows->find( lsw );
	    if ( index == -1 ) { // the linestart widget hasn't been found, try to find it harder
		if ( lsw == w && dockWindowIndex <= (int)dockWindows->count())
		    index = dockWindowIndex;
		else
		    index = 0;
		if ( index < (int)dockWindows->count() )
		    (void)dockWindows->at( index ); // move current to index
	    }
#if defined(QDOCKAREA_DEBUG)
	    qDebug( "     which starts at %d", index );
#endif
	    if ( !insertLine ) { // if we insert the docking widget in the existing line
		// find the index for the widget
		bool inc = TRUE;
		bool firstTime = TRUE;
		for ( dw = dockWindows->current(); dw; dw = dockWindows->next() ) {
		    if ( orientation() == Horizontal )
			dw->setFixedExtentWidth( -1 );
		    else
			dw->setFixedExtentHeight( -1 );
		    if ( !firstTime && lineStarts.find( dw ) != -1 ) // we are in the next line, so break
			break;
		    if ( point_pos( pos, orientation() ) <
			 point_pos( fix_pos( dw ), orientation() ) + size_extent( dw->size(), orientation() ) / 2 ) {
			inc = FALSE;
		    }
		    if ( inc )
			index++;
		    firstTime = FALSE;
		}
#if defined(QDOCKAREA_DEBUG)
		qDebug( "insert at index: %d", index );
#endif
		// if we insert it just before a widget which has a new line, transfer the newline to the docking widget
		// but not if we didn't only mave a widget in its line which was alone in the line before
		if ( !( wasAloneInLine && lr.contains( pos ) )
		     && index >= 0 && index < (int)dockWindows->count() &&
		     dockWindows->at( index )->newLine() && lineOf( index ) == dockLine ) {
#if defined(QDOCKAREA_DEBUG)
		    qDebug( "get rid of the old newline and get me one" );
#endif
		    dockWindows->at( index )->setNewLine( FALSE );
		    dockWindow->setNewLine( TRUE );
		} else if ( wasAloneInLine && lr.contains( pos ) ) {
		    dockWindow->setNewLine( TRUE );
		} else { // if we are somewhere in a line, get rid of the newline
		    dockWindow->setNewLine( FALSE );
		}
	    } else { // insert in a new line, so make sure the dock widget and the widget which will be after it have a newline
#if defined(QDOCKAREA_DEBUG)
		qDebug( "insert a new line" );
#endif
		if ( index < (int)dockWindows->count() ) {
#if defined(QDOCKAREA_DEBUG)
		    qDebug( "give the widget at %d a newline", index );
#endif
		    QDockWindow* nldw = dockWindows->at( index );
		    if ( nldw )
			nldw->setNewLine( TRUE );
		}
#if defined(QDOCKAREA_DEBUG)
		qDebug( "give me a newline" );
#endif
		dockWindow->setNewLine( TRUE );
	    }
	    // finally insert the widget
	    dockWindows->insert( index, dockWindow );
	}
    }

    if ( mse != -10 && w->isResizeEnabled() ) {
	if ( orientation() != Qt::Horizontal )
	    w->setFixedExtentWidth( QMIN( QMAX( w->minimumWidth(), mse ), w->sizeHint().width() ) );
	else
	    w->setFixedExtentHeight( QMIN( QMAX( w->minimumHeight(), mse ), w->sizeHint().height() ) );
    }

    updateLayout();
    setSizePolicy( QSizePolicy( orientation() == Horizontal ? QSizePolicy::Expanding : QSizePolicy::Minimum,
				orientation() == Vertical ? QSizePolicy::Expanding : QSizePolicy::Minimum ) );
}
Beispiel #10
0
QSizePolicy ImportTrack::sizePolicy() const
{
  return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
Beispiel #11
0
RoutingDialog::RoutingDialog(QWidget* parentWindow,
                             DBThread* dbThread,
                             const SettingsRef& settings)
 : QDialog(parentWindow),
   settings(settings),
   dbThread(dbThread),
   from(new QLineEdit()),
   hasStart(false),
   to(new QLineEdit()),
   hasEnd(false),
   routeView(new QTableView()),
   routeModel(new RouteModel())
{
  QVBoxLayout  *mainLayout=new QVBoxLayout();
  QFormLayout  *formLayout=new QFormLayout();
  QHBoxLayout  *fromBoxLayout=new QHBoxLayout();
  QHBoxLayout  *toBoxLayout=new QHBoxLayout();
  QHBoxLayout  *asBoxLayout=new QHBoxLayout();
  QPushButton  *selectFromButton=new QPushButton("...");
  QPushButton  *selectToButton=new QPushButton("...");
  QButtonGroup *routeTypes = new QButtonGroup();
  QPushButton  *routeTypeFoot = new QPushButton("Foot");
  QPushButton  *routeTypeBicycle = new QPushButton("Bicycle");
  QPushButton  *routeTypeCar = new QPushButton("Car");

  from->setReadOnly(true);
  from->setEnabled(false);
  from->setMinimumWidth(QApplication::fontMetrics().width("mlxi")/4*70);
  //from->setPlaceholderText("Starting location");
  to->setReadOnly(true);
  to->setEnabled(false);
  to->setMinimumWidth(QApplication::fontMetrics().width("mlxi")/4*70);
  //to->setPlaceholderText("Destination location");

  selectFromButton->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed));
  selectToButton->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed));

  fromBoxLayout->addWidget(from);
  fromBoxLayout->addWidget(selectFromButton);

  formLayout->addRow("From:",fromBoxLayout);

  toBoxLayout->addWidget(to);
  toBoxLayout->addWidget(selectToButton);

  formLayout->addRow("To:",toBoxLayout);

  osmscout::Vehicle vehicle=settings->GetRoutingVehicle();

  routeTypeFoot->setCheckable(true);
  routeTypeFoot->setChecked(vehicle==osmscout::vehicleFoot);

  routeTypeBicycle->setCheckable(true);
  routeTypeBicycle->setChecked(vehicle==osmscout::vehicleBicycle);

  routeTypeCar->setCheckable(true);
  routeTypeCar->setChecked(vehicle==osmscout::vehicleCar);

  routeTypes->addButton(routeTypeFoot,
                        osmscout::vehicleFoot);
  routeTypes->addButton(routeTypeBicycle,
                        osmscout::vehicleBicycle);
  routeTypes->addButton(routeTypeCar,
                        osmscout::vehicleCar);


  asBoxLayout->addWidget(routeTypeFoot);
  asBoxLayout->addWidget(routeTypeBicycle);
  asBoxLayout->addWidget(routeTypeCar);

  formLayout->addRow("As: ",asBoxLayout);

  mainLayout->addLayout(formLayout);

  routeView->setModel(routeModel);
  routeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
  routeView->setSelectionMode(QAbstractItemView::SingleSelection);
  routeView->setSelectionBehavior(QAbstractItemView::SelectRows);
  routeView->setShowGrid(false);
  routeView->setMinimumWidth(QApplication::fontMetrics().width("mlxi")/4*70);
  routeView->horizontalHeader()->setStretchLastSection(true);
  routeView->horizontalHeader()->setHighlightSections (false);
  routeView->verticalHeader()->hide();
  routeView->setColumnWidth(0,QApplication::fontMetrics().width("mlxi")/4*12);
  routeView->setColumnWidth(1,QApplication::fontMetrics().width("mlxi")/4*12);
  routeView->setColumnWidth(2,QApplication::fontMetrics().width("mlxi")/4*10);
  routeView->setColumnWidth(3,QApplication::fontMetrics().width("mlxi")/4*10);

  mainLayout->addWidget(routeView);

  QDialogButtonBox *buttonBox=new QDialogButtonBox();

  routeButton=buttonBox->addButton("&Route",QDialogButtonBox::ApplyRole);
  buttonBox->addButton(QDialogButtonBox::Close);

  routeButton->setEnabled(false);

  mainLayout->addWidget(buttonBox);

  setLayout(mainLayout);

  connect(selectFromButton,SIGNAL(clicked()),this,SLOT(SelectFrom()));
  connect(selectToButton,SIGNAL(clicked()),this,SLOT(SelectTo()));
  connect(routeButton,SIGNAL(clicked()),this,SLOT(CalculateRoute()));
  connect(buttonBox->button(QDialogButtonBox::Close),SIGNAL(clicked()),this,SLOT(close()));
  connect(routeTypes,SIGNAL(buttonClicked(int)),this,SLOT(OnVehicle(int)));

  if (!route.start.isEmpty()) {
    from->setText(route.start);
    hasStart=true;
  }

  if (!route.end.isEmpty()) {
    to->setText(route.end);
    hasEnd=true;
  }

  if (hasStart && hasEnd) {
    routeButton->setEnabled(true);
  }
}
Beispiel #12
0
QSizePolicy SEQListView::sizePolicy() const
{
  return QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
}
Beispiel #13
0
QSizePolicy RDSchedCodesDialog::sizePolicy() const
{
  return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
Beispiel #14
0
QIStatusBarIndicator::QIStatusBarIndicator(QWidget *pParent /* = 0 */)
    : QWidget(pParent)
{
    /* Configure size-policy: */
    setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
}
Beispiel #15
0
/*
 *  Constructs a Options2 as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
Options2::Options2( QWidget* parent, const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    if ( !name )
	setName( "Options2" );
    setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, 0, 0, sizePolicy().hasHeightForWidth() ) );
    Options2Layout = new QVBoxLayout( this, 0, 6, "Options2Layout"); 

    groupBox6 = new QGroupBox( this, "groupBox6" );
    groupBox6->setColumnLayout(0, Qt::Vertical );
    groupBox6->layout()->setSpacing( 6 );
    groupBox6->layout()->setMargin( 11 );
    groupBox6Layout = new QVBoxLayout( groupBox6->layout() );
    groupBox6Layout->setAlignment( Qt::AlignTop );

    kcfg_UseCustomIconTheme = new QCheckBox( groupBox6, "kcfg_UseCustomIconTheme" );
    groupBox6Layout->addWidget( kcfg_UseCustomIconTheme );
    Options2Layout->addWidget( groupBox6 );

    groupBox4 = new QGroupBox( this, "groupBox4" );
    groupBox4->setColumnLayout(0, Qt::Vertical );
    groupBox4->layout()->setSpacing( 0 );
    groupBox4->layout()->setMargin( 11 );
    groupBox4Layout = new QVBoxLayout( groupBox4->layout() );
    groupBox4Layout->setAlignment( Qt::AlignTop );

    kcfg_UseCustomFonts = new QCheckBox( groupBox4, "kcfg_UseCustomFonts" );
    kcfg_UseCustomFonts->setChecked( FALSE );
    groupBox4Layout->addWidget( kcfg_UseCustomFonts );

    fontGroupBox = new QGroupBox( groupBox4, "fontGroupBox" );
    fontGroupBox->setEnabled( FALSE );
    fontGroupBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, fontGroupBox->sizePolicy().hasHeightForWidth() ) );
    fontGroupBox->setFrameShape( QGroupBox::NoFrame );
    fontGroupBox->setLineWidth( 0 );
    fontGroupBox->setFlat( TRUE );
    fontGroupBox->setColumnLayout(0, Qt::Vertical );
    fontGroupBox->layout()->setSpacing( 6 );
    fontGroupBox->layout()->setMargin( 11 );
    fontGroupBoxLayout = new QVBoxLayout( fontGroupBox->layout() );
    fontGroupBoxLayout->setAlignment( Qt::AlignTop );

    layout5 = new QHBoxLayout( 0, 0, 6, "layout5"); 

    textLabel3 = new QLabel( fontGroupBox, "textLabel3" );
    textLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, 0, 0, textLabel3->sizePolicy().hasHeightForWidth() ) );
    textLabel3->setMinimumSize( QSize( 90, 0 ) );
    layout5->addWidget( textLabel3 );

    kcfg_PlaylistWindowFont = new KFontRequester( fontGroupBox, "kcfg_PlaylistWindowFont" );
    kcfg_PlaylistWindowFont->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, kcfg_PlaylistWindowFont->sizePolicy().hasHeightForWidth() ) );
    layout5->addWidget( kcfg_PlaylistWindowFont );
    fontGroupBoxLayout->addLayout( layout5 );

    layout4 = new QHBoxLayout( 0, 0, 6, "layout4"); 

    textLabel1 = new QLabel( fontGroupBox, "textLabel1" );
    textLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, 0, 0, textLabel1->sizePolicy().hasHeightForWidth() ) );
    textLabel1->setMinimumSize( QSize( 90, 0 ) );
    textLabel1->setAlignment( int( QLabel::AlignVCenter ) );
    layout4->addWidget( textLabel1 );

    kcfg_PlayerWidgetFont = new KFontRequester( fontGroupBox, "kcfg_PlayerWidgetFont" );
    kcfg_PlayerWidgetFont->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, kcfg_PlayerWidgetFont->sizePolicy().hasHeightForWidth() ) );
    layout4->addWidget( kcfg_PlayerWidgetFont );
    fontGroupBoxLayout->addLayout( layout4 );

    layout6 = new QHBoxLayout( 0, 0, 6, "layout6"); 

    textLabel3_2 = new QLabel( fontGroupBox, "textLabel3_2" );
    textLabel3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, 0, 0, textLabel3_2->sizePolicy().hasHeightForWidth() ) );
    textLabel3_2->setMinimumSize( QSize( 90, 0 ) );
    layout6->addWidget( textLabel3_2 );

    kcfg_ContextBrowserFont = new KFontRequester( fontGroupBox, "kcfg_ContextBrowserFont" );
    kcfg_ContextBrowserFont->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, kcfg_ContextBrowserFont->sizePolicy().hasHeightForWidth() ) );
    layout6->addWidget( kcfg_ContextBrowserFont );
    fontGroupBoxLayout->addLayout( layout6 );
    groupBox4Layout->addWidget( fontGroupBox );
    Options2Layout->addWidget( groupBox4 );

    groupBox3 = new QGroupBox( this, "groupBox3" );
    groupBox3->setColumnLayout(0, Qt::Vertical );
    groupBox3->layout()->setSpacing( 6 );
    groupBox3->layout()->setMargin( 11 );
    groupBox3Layout = new QGridLayout( groupBox3->layout() );
    groupBox3Layout->setAlignment( Qt::AlignTop );

    radioGroup = new QButtonGroup( groupBox3, "radioGroup" );
    radioGroup->setFrameShape( QButtonGroup::NoFrame );
    radioGroup->setColumnLayout(0, Qt::Vertical );
    radioGroup->layout()->setSpacing( 6 );
    radioGroup->layout()->setMargin( 0 );
    radioGroupLayout = new QGridLayout( radioGroup->layout() );
    radioGroupLayout->setAlignment( Qt::AlignTop );

    layout2 = new QVBoxLayout( 0, 0, 0, "layout2"); 

    kcfg_SchemeCustom = new QRadioButton( radioGroup, "kcfg_SchemeCustom" );
    kcfg_SchemeCustom->setChecked( TRUE );
    layout2->addWidget( kcfg_SchemeCustom );

    customSchemeBox = new QGroupBox( radioGroup, "customSchemeBox" );
    customSchemeBox->setEnabled( TRUE );
    customSchemeBox->setFocusPolicy( QGroupBox::NoFocus );
    customSchemeBox->setFrameShape( QGroupBox::NoFrame );
    customSchemeBox->setFlat( FALSE );
    customSchemeBox->setChecked( FALSE );
    customSchemeBox->setColumnLayout(0, Qt::Vertical );
    customSchemeBox->layout()->setSpacing( 6 );
    customSchemeBox->layout()->setMargin( 11 );
    customSchemeBoxLayout = new QGridLayout( customSchemeBox->layout() );
    customSchemeBoxLayout->setAlignment( Qt::AlignTop );

    fgLabel = new QLabel( customSchemeBox, "fgLabel" );
    fgLabel->setEnabled( TRUE );
    fgLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)5, 0, 0, fgLabel->sizePolicy().hasHeightForWidth() ) );
    fgLabel->setMinimumSize( QSize( 0, 0 ) );
    fgLabel->setTextFormat( QLabel::AutoText );

    customSchemeBoxLayout->addWidget( fgLabel, 0, 0 );

    kcfg_PlaylistWindowFgColor = new KColorButton( customSchemeBox, "kcfg_PlaylistWindowFgColor" );
    kcfg_PlaylistWindowFgColor->setEnabled( TRUE );
    kcfg_PlaylistWindowFgColor->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 2, 0, kcfg_PlaylistWindowFgColor->sizePolicy().hasHeightForWidth() ) );
    kcfg_PlaylistWindowFgColor->setColor( QColor( 255, 255, 255 ) );

    customSchemeBoxLayout->addWidget( kcfg_PlaylistWindowFgColor, 0, 1 );

    bgColor = new QLabel( customSchemeBox, "bgColor" );
    bgColor->setEnabled( TRUE );
    bgColor->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)5, 0, 0, bgColor->sizePolicy().hasHeightForWidth() ) );
    bgColor->setTextFormat( QLabel::AutoText );

    customSchemeBoxLayout->addWidget( bgColor, 1, 0 );

    kcfg_PlaylistWindowBgColor = new KColorButton( customSchemeBox, "kcfg_PlaylistWindowBgColor" );
    kcfg_PlaylistWindowBgColor->setEnabled( TRUE );
    kcfg_PlaylistWindowBgColor->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 2, 0, kcfg_PlaylistWindowBgColor->sizePolicy().hasHeightForWidth() ) );
    kcfg_PlaylistWindowBgColor->setMinimumSize( QSize( 0, 0 ) );
    kcfg_PlaylistWindowBgColor->setMaximumSize( QSize( 192, 32767 ) );
    kcfg_PlaylistWindowBgColor->setColor( QColor( 32, 32, 80 ) );

    customSchemeBoxLayout->addWidget( kcfg_PlaylistWindowBgColor, 1, 1 );
    layout2->addWidget( customSchemeBox );

    radioGroupLayout->addLayout( layout2, 2, 0 );

    kcfg_SchemeKDE = new QRadioButton( radioGroup, "kcfg_SchemeKDE" );
    radioGroup->insert( kcfg_SchemeKDE, 0 );

    radioGroupLayout->addWidget( kcfg_SchemeKDE, 0, 0 );

    kcfg_SchemeAmarok = new QRadioButton( radioGroup, "kcfg_SchemeAmarok" );
    radioGroup->insert( kcfg_SchemeAmarok, 1 );

    radioGroupLayout->addWidget( kcfg_SchemeAmarok, 1, 0 );

    groupBox3Layout->addWidget( radioGroup, 0, 0 );
    Options2Layout->addWidget( groupBox3 );

    contextGroupBox = new QGroupBox( this, "contextGroupBox" );
    contextGroupBox->setColumnLayout(0, Qt::Vertical );
    contextGroupBox->layout()->setSpacing( 6 );
    contextGroupBox->layout()->setMargin( 11 );
    contextGroupBoxLayout = new QVBoxLayout( contextGroupBox->layout() );
    contextGroupBoxLayout->setAlignment( Qt::AlignTop );

    layout6_2 = new QHBoxLayout( 0, 0, 6, "layout6_2"); 

    textLabel1_2 = new QLabel( contextGroupBox, "textLabel1_2" );
    textLabel1_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, textLabel1_2->sizePolicy().hasHeightForWidth() ) );
    layout6_2->addWidget( textLabel1_2 );

    styleComboBox = new KComboBox( FALSE, contextGroupBox, "styleComboBox" );
    layout6_2->addWidget( styleComboBox );
    contextGroupBoxLayout->addLayout( layout6_2 );

    layout5_2 = new QHBoxLayout( 0, 0, 6, "layout5_2"); 

    installPushButton = new QPushButton( contextGroupBox, "installPushButton" );
    layout5_2->addWidget( installPushButton );

    retrievePushButton = new QPushButton( contextGroupBox, "retrievePushButton" );
    layout5_2->addWidget( retrievePushButton );
    spacer2 = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout5_2->addItem( spacer2 );

    uninstallPushButton = new QPushButton( contextGroupBox, "uninstallPushButton" );
    layout5_2->addWidget( uninstallPushButton );
    contextGroupBoxLayout->addLayout( layout5_2 );
    Options2Layout->addWidget( contextGroupBox );
    spacer1 = new QSpacerItem( 20, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
    Options2Layout->addItem( spacer1 );
    languageChange();
    resize( QSize(403, 481).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( kcfg_UseCustomFonts, SIGNAL( toggled(bool) ), fontGroupBox, SLOT( setEnabled(bool) ) );
    connect( kcfg_SchemeCustom, SIGNAL( toggled(bool) ), customSchemeBox, SLOT( setEnabled(bool) ) );
    connect( installPushButton, SIGNAL( clicked() ), this, SLOT( installPushButton_clicked() ) );
    connect( retrievePushButton, SIGNAL( clicked() ), this, SLOT( retrievePushButton_clicked() ) );
    connect( uninstallPushButton, SIGNAL( clicked() ), this, SLOT( uninstallPushButton_clicked() ) );
    connect( styleComboBox, SIGNAL( activated(const QString&) ), this, SLOT( styleComboBox_activated(const QString&) ) );

    // buddies
    fgLabel->setBuddy( kcfg_PlaylistWindowFgColor );
    bgColor->setBuddy( kcfg_PlaylistWindowBgColor );
    init();
}
/*
 *  Constructs a RichTextFontDialog as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
RichTextFontDialog::RichTextFontDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "RichTextFontDialog" );
    setSizeGripEnabled( TRUE );
    RichTextFontDialogLayout = new QGridLayout( this, 1, 1, 11, 6, "RichTextFontDialogLayout"); 

    Layout6 = new QGridLayout( 0, 1, 1, 0, 6, "Layout6"); 

    fontCombo = new QComboBox( FALSE, this, "fontCombo" );

    Layout6->addMultiCellWidget( fontCombo, 0, 0, 1, 2 );

    TextLabel1_2 = new QLabel( this, "TextLabel1_2" );

    Layout6->addWidget( TextLabel1_2, 0, 0 );

    TextLabel2 = new QLabel( this, "TextLabel2" );

    Layout6->addWidget( TextLabel2, 1, 0 );
    Spacer13 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout6->addItem( Spacer13, 2, 2 );

    TextLabel1 = new QLabel( this, "TextLabel1" );

    Layout6->addWidget( TextLabel1, 2, 0 );

    fontSizeCombo = new QComboBox( FALSE, this, "fontSizeCombo" );
    fontSizeCombo->setEditable( TRUE );
    fontSizeCombo->setInsertionPolicy( QComboBox::AtTop );

    Layout6->addMultiCellWidget( fontSizeCombo, 1, 1, 1, 2 );

    colorButton = new QToolButton( this, "colorButton" );
    colorButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, colorButton->sizePolicy().hasHeightForWidth() ) );
    colorButton->setMinimumSize( QSize( 40, 20 ) );
    colorButton->setPaletteBackgroundColor( QColor( 0, 0, 0 ) );
    colorButton->setFocusPolicy( QToolButton::TabFocus );

    Layout6->addWidget( colorButton, 2, 1 );

    RichTextFontDialogLayout->addLayout( Layout6, 0, 0 );
    Spacer14 = new QSpacerItem( 20, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
    RichTextFontDialogLayout->addItem( Spacer14, 1, 0 );

    Line1 = new QFrame( this, "Line1" );
    Line1->setFrameShape( QFrame::HLine );
    Line1->setFrameShadow( QFrame::Sunken );
    Line1->setFrameShape( QFrame::HLine );

    RichTextFontDialogLayout->addWidget( Line1, 2, 0 );

    Layout15 = new QHBoxLayout( 0, 0, 6, "Layout15"); 
    Spacer12 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout15->addItem( Spacer12 );

    okButton = new QPushButton( this, "okButton" );
    Layout15->addWidget( okButton );

    cancelButton = new QPushButton( this, "cancelButton" );
    Layout15->addWidget( cancelButton );

    RichTextFontDialogLayout->addLayout( Layout15, 3, 0 );
    languageChange();
    resize( QSize(255, 158).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( colorButton, SIGNAL( clicked() ), this, SLOT( selectColor() ) );
    connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );

    // tab order
    setTabOrder( fontCombo, fontSizeCombo );
    setTabOrder( fontSizeCombo, colorButton );
    setTabOrder( colorButton, okButton );
    setTabOrder( okButton, cancelButton );

    // buddies
    TextLabel1_2->setBuddy( fontCombo );
    TextLabel2->setBuddy( fontSizeCombo );
    TextLabel1->setBuddy( colorButton );
    init();
}
Beispiel #17
0
MeshifyPopup::MeshifyPopup()
    : DVGui::Dialog(TApp::instance()->getMainWindow(), true, false,
                    "MeshifyPopup")
    , m_r(-1)
    , m_c(-1) {
  setWindowTitle(tr("Create Mesh"));
  setLabelWidth(0);
  setModal(false);

  setTopMargin(0);
  setTopSpacing(0);

  beginVLayout();

  QSplitter *splitter = new QSplitter(Qt::Vertical);
  splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,
                                      QSizePolicy::MinimumExpanding));
  addWidget(splitter);

  endVLayout();

  //------------------------- Top Layout --------------------------

  QScrollArea *scrollArea = new QScrollArea(splitter);
  scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  scrollArea->setWidgetResizable(true);
  scrollArea->setMinimumWidth(450);
  splitter->addWidget(scrollArea);
  splitter->setStretchFactor(0, 1);

  QFrame *topWidget = new QFrame(scrollArea);
  scrollArea->setWidget(topWidget);

  QGridLayout *topLayout =
      new QGridLayout(topWidget);  // Needed to justify at top
  topWidget->setLayout(topLayout);

  //------------------------- Parameters --------------------------

  int row = 0;

  QLabel *edgesLengthLabel = new QLabel(tr("Mesh Edges Length:"));
  topLayout->addWidget(edgesLengthLabel, row, 0,
                       Qt::AlignRight | Qt::AlignVCenter);

  m_edgesLength = new DVGui::MeasuredDoubleField;
  m_edgesLength->setMeasure("length.x");
  m_edgesLength->setRange(0.0, 1.0);  // In inches (standard unit)
  m_edgesLength->setValue(0.2);

  topLayout->addWidget(m_edgesLength, row++, 1);

  QLabel *rasterizationDpiLabel = new QLabel(tr("Rasterization DPI:"));
  topLayout->addWidget(rasterizationDpiLabel, row, 0,
                       Qt::AlignRight | Qt::AlignVCenter);

  m_rasterizationDpi = new DVGui::DoubleLineEdit;
  m_rasterizationDpi->setRange(1.0, (std::numeric_limits<double>::max)());
  m_rasterizationDpi->setValue(300.0);

  topLayout->addWidget(m_rasterizationDpi, row++, 1);

  QLabel *shapeMarginLabel = new QLabel(tr("Mesh Margin (pixels):"));
  topLayout->addWidget(shapeMarginLabel, row, 0,
                       Qt::AlignRight | Qt::AlignVCenter);

  m_margin = new DVGui::IntLineEdit;
  m_margin->setRange(2, (std::numeric_limits<int>::max)());
  m_margin->setValue(5);

  topLayout->addWidget(m_margin, row++, 1);

  connect(m_edgesLength, SIGNAL(valueChanged(bool)), this,
          SLOT(onParamsChanged(bool)));
  connect(m_rasterizationDpi, SIGNAL(editingFinished()), this,
          SLOT(onParamsChanged()));
  connect(m_margin, SIGNAL(editingFinished()), this, SLOT(onParamsChanged()));

  topLayout->setRowStretch(row, 1);

  //------------------------- View Widget -------------------------

  // NOTE: It's IMPORTANT that parent widget is supplied. It's somewhat
  // used by QSplitter to decide the initial widget sizes...

  m_viewer = new Swatch(splitter);
  m_viewer->setMinimumHeight(150);
  m_viewer->setFocusPolicy(Qt::WheelFocus);

  splitter->addWidget(m_viewer);

  //--------------------------- Buttons ---------------------------

  m_okBtn = new QPushButton(tr("Apply"));
  addButtonBarWidget(m_okBtn);

  connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

  // Finally, acquire current selection
  onCellSwitched();

  m_viewer->resize(0, 350);
  resize(600, 700);
}
Beispiel #18
0
QSizePolicy TestImport::sizePolicy() const
{
    return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
BrightnessAndContrastPopup::BrightnessAndContrastPopup()
	: Dialog(TApp::instance()->getMainWindow(), true, false, "BrightnessAndContrast"), m_startRas(0)
{
	setWindowTitle(tr("Brightness and Contrast"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	topWidget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	scrollArea->setWidget(topWidget);

	QGridLayout *topLayout = new QGridLayout(this);
	topWidget->setLayout(topLayout);

	//------------------------- Parameters --------------------------

	//Brightness
	QLabel *brightnessLabel = new QLabel(tr("Brightness:"));
	topLayout->addWidget(brightnessLabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_brightnessField = new DVGui::IntField(topWidget);
	m_brightnessField->setRange(-127, 127);
	m_brightnessField->setValue(0);
	topLayout->addWidget(m_brightnessField, 0, 1);

	//Contrast
	QLabel *contrastLabel = new QLabel(tr("Contrast:"));
	topLayout->addWidget(contrastLabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_contrastField = new DVGui::IntField(topWidget);
	m_contrastField->setRange(-127, 127);
	m_contrastField->setValue(0);
	topLayout->addWidget(m_contrastField, 1, 1);

	topLayout->setRowStretch(2, 1);

	//--------------------------- Swatch ----------------------------

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);
	splitter->addWidget(m_viewer);

	//--------------------------- Button ----------------------------

	m_okBtn = new QPushButton(QString("Apply"), this);
	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	addButtonBarWidget(m_okBtn);

	//------------------------ Connections --------------------------

	TApp *app = TApp::instance();

	bool ret = true;

	ret = ret && connect(m_brightnessField, SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));
	ret = ret && connect(m_contrastField, SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));

	assert(ret);

	m_viewer->resize(0, 350);
	resize(600, 500);
}
Beispiel #20
0
void KMJobViewer::initActions()
{
    // job actions
    KAction	*hact = new KAction(i18n("&Hold"),"stop",0,this,SLOT(slotHold()),actionCollection(),"job_hold");
    KAction	*ract = new KAction(i18n("&Resume"),"run",0,this,SLOT(slotResume()),actionCollection(),"job_resume");
    KAction	*dact = new KAction(i18n("Remo&ve"),"edittrash",Qt::Key_Delete,this,SLOT(slotRemove()),actionCollection(),"job_remove");
    KAction *sact = new KAction(i18n("Res&tart"),"redo",0,this,SLOT(slotRestart()),actionCollection(),"job_restart");
    KActionMenu *mact = new KActionMenu(i18n("&Move to Printer"),"fileprint",actionCollection(),"job_move");
    mact->setDelayed(false);
    connect(mact->popupMenu(),SIGNAL(activated(int)),SLOT(slotMove(int)));
    connect(mact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
    connect(mact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
    connect(mact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowMoveMenu()));
    KToggleAction	*tact = new KToggleAction(i18n("&Toggle Completed Jobs"),"history",0,actionCollection(),"view_completed");
    tact->setEnabled(m_manager->actions() & KMJob::ShowCompleted);
    connect(tact,SIGNAL(toggled(bool)),SLOT(slotShowCompleted(bool)));
    KToggleAction	*uact = new KToggleAction(i18n("Show Only User Jobs"), "personal", 0, actionCollection(), "view_user_jobs");
    uact->setCheckedState(KGuiItem(i18n("Hide Only User Jobs"),"personal"));
    connect(uact, SIGNAL(toggled(bool)), SLOT(slotUserOnly(bool)));
    m_userfield = new QLineEdit(0);
    m_userfield->setText(getenv("USER"));
    connect(m_userfield, SIGNAL(returnPressed()), SLOT(slotUserChanged()));
    connect(uact, SIGNAL(toggled(bool)), m_userfield, SLOT(setEnabled(bool)));
    m_userfield->setEnabled(false);
    m_userfield->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    KWidgetAction	*ufact = new KWidgetAction(m_userfield, i18n("User Name"), 0, 0, 0, actionCollection(), "view_username");

    if (!m_pop)
    {
        m_pop = new QPopupMenu(this);
        connect(m_pop,SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
        connect(m_pop,SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
        hact->plug(m_pop);
        ract->plug(m_pop);
        m_pop->insertSeparator();
        dact->plug(m_pop);
        mact->plug(m_pop);
        m_pop->insertSeparator();
        sact->plug(m_pop);
    }

    // Filter actions
    KActionMenu	*fact = new KActionMenu(i18n("&Select Printer"), "kdeprint_printer", actionCollection(), "filter_modify");
    fact->setDelayed(false);
    connect(fact->popupMenu(),SIGNAL(activated(int)),SLOT(slotPrinterSelected(int)));
    connect(fact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
    connect(fact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
    connect(fact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowPrinterMenu()));

    if (!m_standalone)
    {
        KToolBar	*toolbar = toolBar();
        hact->plug(toolbar);
        ract->plug(toolbar);
        toolbar->insertSeparator();
        dact->plug(toolbar);
        mact->plug(toolbar);
        toolbar->insertSeparator();
        sact->plug(toolbar);
        toolbar->insertSeparator();
        tact->plug(toolbar);
        uact->plug(toolbar);
        ufact->plug(toolbar);
    }
    else
    {   // stand-alone application
        KStdAction::quit(kapp,SLOT(quit()),actionCollection());
        KStdAction::close(this,SLOT(slotClose()),actionCollection());
        KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection());

        // refresh action
        new KAction(i18n("Refresh"),"reload",0,this,SLOT(slotRefresh()),actionCollection(),"refresh");

        // create status bar
        KStatusBar	*statusbar = statusBar();
        m_stickybox = new QCheckBox( i18n( "Keep window permanent" ), statusbar );
        statusbar->addWidget( m_stickybox, 1, false );
        statusbar->insertItem(" " + i18n("Max.: %1").arg(i18n("Unlimited"))+ " ", 0, 0, true);
        statusbar->setItemFixed(0);
        updateStatusBar();

        createGUI();
    }

    loadPluginActions();
    slotSelectionChanged();
}
Beispiel #21
0
QSizePolicy Splitter::sizePolicy() const
{
    return QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
}
Beispiel #22
0
QSizePolicy EditGpi::sizePolicy() const
{
  return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
Beispiel #23
0
////------------ Private Methods ----------------
void mtsPIDQtWidget::setupUi(void)
{
    QFont font;
    font.setBold(true);
    font.setPointSize(12);

    const double maximum = 30000;

    QGridLayout * gridLayout = new QGridLayout();
    gridLayout->setSpacing(1);

    int row = 0;
    QLabel * currentPosLabel = new QLabel("Current position (deg)");
    currentPosLabel->setAlignment(Qt::AlignRight);
    gridLayout->addWidget(currentPosLabel, row, 0);
    QVRCurrentPositionWidget = new vctQtWidgetDynamicVectorDoubleRead();
    QVRCurrentPositionWidget->SetPrecision(3);
    gridLayout->addWidget(QVRCurrentPositionWidget, row, 1);
    row++;

    QLabel * desiredPosLabel = new QLabel("Desired position (deg)");
    desiredPosLabel->setAlignment(Qt::AlignRight);
    gridLayout->addWidget(desiredPosLabel, row, 0);
    QVWDesiredPositionWidget = new vctQtWidgetDynamicVectorDoubleWrite(vctQtWidgetDynamicVectorDoubleWrite::SPINBOX_WIDGET);
    QVWDesiredPositionWidget->SetStep(0.1);
    QVWDesiredPositionWidget->SetRange(-360.0, 360.0);
    gridLayout->addWidget(QVWDesiredPositionWidget, row, 1);
    row++;

    QLabel * currentEffortLabel = new QLabel("Current effort (Nm)");
    currentEffortLabel->setAlignment(Qt::AlignRight);
    gridLayout->addWidget(currentEffortLabel, row, 0);
    QVRCurrentEffortWidget = new vctQtWidgetDynamicVectorDoubleRead();
    QVRCurrentEffortWidget->SetPrecision(3);
    gridLayout->addWidget(QVRCurrentEffortWidget, row, 1);
    row++;

    QLabel * desiredEffortLabel = new QLabel("Desired effort (Nm)");
    desiredEffortLabel->setAlignment(Qt::AlignRight);
    gridLayout->addWidget(desiredEffortLabel, row, 0);
    QVWDesiredEffortWidget = new vctQtWidgetDynamicVectorDoubleRead();
    QVWDesiredEffortWidget->SetPrecision(3);
    gridLayout->addWidget(QVWDesiredEffortWidget, row, 1);
    row++;

    QLabel * pLabel = new QLabel("PGain");
    pLabel->setAlignment(Qt::AlignRight);
    gridLayout->addWidget(pLabel);
    QVWPGainWidget = new vctQtWidgetDynamicVectorDoubleWrite(vctQtWidgetDynamicVectorDoubleWrite::SPINBOX_WIDGET);
    QVWPGainWidget->SetStep(0.01);
    QVWPGainWidget->SetPrecision(3);
    QVWPGainWidget->SetRange(-maximum, maximum);
    gridLayout->addWidget(QVWPGainWidget, row, 1);
    row++;

    QLabel * dLabel = new QLabel("DGain");
    dLabel->setAlignment(Qt::AlignRight);
    gridLayout->addWidget(dLabel);
    QVWDGainWidget = new vctQtWidgetDynamicVectorDoubleWrite(vctQtWidgetDynamicVectorDoubleWrite::SPINBOX_WIDGET);
    QVWDGainWidget->SetStep(0.01);
    QVWDGainWidget->SetPrecision(3);
    QVWDGainWidget->SetRange(-maximum, maximum);
    gridLayout->addWidget(QVWDGainWidget, row, 1);
    row++;

    QLabel * iLabel = new QLabel("IGain");
    iLabel->setAlignment(Qt::AlignRight);
    gridLayout->addWidget(iLabel);
    QVWIGainWidget = new vctQtWidgetDynamicVectorDoubleWrite(vctQtWidgetDynamicVectorDoubleWrite::SPINBOX_WIDGET);
    QVWIGainWidget->SetStep(0.001);
    QVWIGainWidget->SetPrecision(5);
    QVWIGainWidget->SetRange(-maximum, maximum);
    gridLayout->addWidget(QVWIGainWidget, row, 1);
    row++;

    // plot
    QHBoxLayout * plotLayout = new QHBoxLayout;
    // plot control
    QVBoxLayout * plotButtonsLayout = new QVBoxLayout;
    // - pick axis to display
    QLabel * plotIndexLabel = new QLabel("Index");
    plotButtonsLayout->addWidget(plotIndexLabel);
    QSBPlotIndex = new QSpinBox();
    QSBPlotIndex->setRange(0, NumberOfAxis);
    plotButtonsLayout->addWidget(QSBPlotIndex);
    // legend
    QLabel * label;
    QPalette palette;
    palette.setColor(QPalette::Window, Qt::black);
    label = new QLabel("Current position");
    label->setAutoFillBackground(true);
    palette.setColor(QPalette::WindowText, Qt::red);
    label->setPalette(palette);
    plotButtonsLayout->addWidget(label);
    label = new QLabel("Desired position");
    label->setAutoFillBackground(true);
    palette.setColor(QPalette::WindowText, Qt::green);
    label->setPalette(palette);
    plotButtonsLayout->addWidget(label);
    label = new QLabel("Current velocity");
    label->setAutoFillBackground(true);
    palette.setColor(QPalette::WindowText, Qt::gray);
    label->setPalette(palette);
    plotButtonsLayout->addWidget(label);
    label = new QLabel("Current effort");
    label->setAutoFillBackground(true);
    palette.setColor(QPalette::WindowText, Qt::cyan);
    label->setPalette(palette);
    plotButtonsLayout->addWidget(label);
    label = new QLabel("Desired effort");
    label->setAutoFillBackground(true);
    palette.setColor(QPalette::WindowText, Qt::white);
    label->setPalette(palette);
    plotButtonsLayout->addWidget(label);
    plotButtonsLayout->addStretch();
    plotLayout->addLayout(plotButtonsLayout);
    // plotting area
    QVPlot = new vctPlot2DOpenGLQtWidget();
    vctPlot2DBase::Scale * scalePosition = QVPlot->AddScale("positions");
    CurrentPositionSignal = scalePosition->AddSignal("current");
    CurrentPositionSignal->SetColor(vctDouble3(1.0, 0.0, 0.0));
    DesiredPositionSignal = scalePosition->AddSignal("desired");
    DesiredPositionSignal->SetColor(vctDouble3(0.0, 1.0, 0.0));
    vctPlot2DBase::Scale * scaleVelocity = QVPlot->AddScale("velocities");
    CurrentVelocitySignal = scaleVelocity->AddSignal("current");
    CurrentVelocitySignal->SetColor(vctDouble3(0.5, 0.5, 0.5));
    vctPlot2DBase::Scale * scaleEffort = QVPlot->AddScale("efforts");
    CurrentEffortSignal = scaleEffort->AddSignal("-current");
    CurrentEffortSignal->SetColor(vctDouble3(0.0, 1.0, 1.0));
    DesiredEffortSignal = scaleEffort->AddSignal("-desired");
    DesiredEffortSignal->SetColor(vctDouble3(1.0, 1.0, 1.0));
    QVPlot->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    plotLayout->addWidget(QVPlot);

    // control
    QCBEnableDirectControl = new QCheckBox("Direct control");
    QCBEnablePID = new QCheckBox("Enable PID");
    QCBEnableTorqueMode = new QCheckBox("Enable torque mode");
    QPBMaintainPosition = new QPushButton("Maintain position");
    QPBZeroPosition = new QPushButton("Zero position");
    QPBResetPIDGain = new QPushButton("Reset PID gains");
    QHBoxLayout * controlLayout = new QHBoxLayout;
    controlLayout->addWidget(QCBEnableDirectControl);
    controlLayout->addWidget(QCBEnablePID);
    controlLayout->addWidget(QCBEnableTorqueMode);
    controlLayout->addWidget(QPBMaintainPosition);
    controlLayout->addWidget(QPBZeroPosition);
    controlLayout->addWidget(QPBResetPIDGain);
    controlLayout->addStretch();
    QGroupBox * controlGroupBox = new QGroupBox("Control");
    controlGroupBox->setLayout(controlLayout);

    connect(QCBEnableDirectControl, SIGNAL(toggled(bool)), this, SLOT(SlotEnableDirectControl(bool)));
    connect(QCBEnablePID, SIGNAL(clicked(bool)), this, SLOT(SlotEnablePID(bool)));
    connect(this, SIGNAL(SignalEnablePID(bool)), this, SLOT(SlotEnableEventHandler(bool)));
    connect(QCBEnableTorqueMode, SIGNAL(toggled(bool)), this, SLOT(SlotEnableTorqueMode(bool)));
    connect(QPBMaintainPosition, SIGNAL(clicked()), this, SLOT(SlotMaintainPosition()));
    connect(QPBZeroPosition, SIGNAL(clicked()), this, SLOT(SlotZeroPosition()));
    connect(QPBResetPIDGain, SIGNAL(clicked()), this, SLOT(SlotResetPIDGain()));
    connect(QSBPlotIndex, SIGNAL(valueChanged(int)), this, SLOT(SlotPlotIndex(int)));

    // main layout
    QVBoxLayout * mainLayout = new QVBoxLayout;
    mainLayout->addLayout(gridLayout);
    mainLayout->addLayout(plotLayout);
    mainLayout->addWidget(controlGroupBox);

    setLayout(mainLayout);

    setWindowTitle(this->GetName().c_str());
    setMinimumWidth(750);
    resize(sizeHint());

    // connect signals & slots
    connect(QVWDesiredPositionWidget, SIGNAL(valueChanged()), this, SLOT(SlotPositionChanged()));
    connect(QVWPGainWidget, SIGNAL(valueChanged()), this, SLOT(SlotPGainChanged()));
    connect(QVWDGainWidget, SIGNAL(valueChanged()), this, SLOT(SlotDGainChanged()));
    connect(QVWIGainWidget, SIGNAL(valueChanged()), this, SLOT(SlotIGainChanged()));

    // set initial values
    QCBEnableDirectControl->setChecked(DirectControl);
    SlotEnableDirectControl(DirectControl);
}
Beispiel #24
0
KateFileSelector::KateFileSelector( KateMainWindow *mainWindow,
                                    KateViewManager *viewManager,
                                    QWidget * parent, const char * name )
    : QVBox (parent, name),
      mainwin(mainWindow),
      viewmanager(viewManager)
{
  mActionCollection = new KActionCollection( this );

  QtMsgHandler oldHandler = qInstallMsgHandler( silenceQToolBar );

  KateFileSelectorToolBarParent *tbp=new KateFileSelectorToolBarParent(this);
  toolbar = new KateFileSelectorToolBar(tbp);
  tbp->setToolBar(toolbar);
  toolbar->setMovingEnabled(false);
  toolbar->setFlat(true);
  qInstallMsgHandler( oldHandler );

  cmbPath = new KURLComboBox( KURLComboBox::Directories, true, this, "path combo" );
  cmbPath->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
  KURLCompletion* cmpl = new KURLCompletion(KURLCompletion::DirCompletion);
  cmbPath->setCompletionObject( cmpl );
  cmbPath->setAutoDeleteCompletionObject( true );
  cmbPath->listBox()->installEventFilter( this );

  dir = new KDirOperator(KURL(), this, "operator");
  dir->setView(KFile::/* Simple */Detail);
  dir->view()->setSelectionMode(KFile::Extended);
  connect ( dir, SIGNAL( viewChanged(KFileView *) ),
                   this, SLOT( selectorViewChanged(KFileView *) ) );
  setStretchFactor(dir, 2);

  KActionCollection *coll = dir->actionCollection();
  // some shortcuts of diroperator that clashes with Kate
  coll->action( "delete" )->setShortcut( KShortcut( ALT + Key_Delete ) );
  coll->action( "reload" )->setShortcut( KShortcut( ALT + Key_F5 ) );
  coll->action( "back" )->setShortcut( KShortcut( ALT + SHIFT + Key_Left ) );
  coll->action( "forward" )->setShortcut( KShortcut( ALT + SHIFT + Key_Right ) );
  // some consistency - reset up for dir too
  coll->action( "up" )->setShortcut( KShortcut( ALT + SHIFT + Key_Up ) );
  coll->action( "home" )->setShortcut( KShortcut( CTRL + ALT + Key_Home ) );

  // bookmarks action!
  KActionMenu *acmBookmarks = new KActionMenu( i18n("Bookmarks"), "bookmark",
        mActionCollection, "bookmarks" );
  acmBookmarks->setDelayed( false );
  bookmarkHandler = new KBookmarkHandler( this, acmBookmarks->popupMenu() );
  QHBox* filterBox = new QHBox(this);

  btnFilter = new QToolButton( filterBox );
  btnFilter->setIconSet( SmallIconSet("filter" ) );
  btnFilter->setToggleButton( true );
  filter = new KHistoryCombo( true, filterBox, "filter");
  filter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
  filterBox->setStretchFactor(filter, 2);
  connect( btnFilter, SIGNAL( clicked() ), this, SLOT( btnFilterClick() ) );

  connect( filter, SIGNAL( activated(const QString&) ),
                   SLOT( slotFilterChange(const QString&) ) );
  connect( filter, SIGNAL( returnPressed(const QString&) ),
           filter, SLOT( addToHistory(const QString&) ) );

  // kaction for the dir sync method
  acSyncDir = new KAction( i18n("Current Document Folder"), "curfiledir", 0,
        this, SLOT( setActiveDocumentDir() ), mActionCollection, "sync_dir" );
  toolbar->setIconText( KToolBar::IconOnly );
  toolbar->setIconSize( 16 );
  toolbar->setEnableContextMenu( false );

  connect( cmbPath, SIGNAL( urlActivated( const KURL&  )),
             this,  SLOT( cmbPathActivated( const KURL& ) ));
  connect( cmbPath, SIGNAL( returnPressed( const QString&  )),
             this,  SLOT( cmbPathReturnPressed( const QString& ) ));
  connect(dir, SIGNAL(urlEntered(const KURL&)),
             this, SLOT(dirUrlEntered(const KURL&)) );

  connect(dir, SIGNAL(finishedLoading()),
             this, SLOT(dirFinishedLoading()) );

  // enable dir sync button if current doc has a valid URL
  connect ( viewmanager, SIGNAL( viewChanged() ),
              this, SLOT( kateViewChanged() ) );

  // Connect the bookmark handler
  connect( bookmarkHandler, SIGNAL( openURL( const QString& )),
           this, SLOT( setDir( const QString& ) ) );

  waitingUrl = QString::null;

  // whatsthis help
  QWhatsThis::add( cmbPath,
       i18n("<p>Here you can enter a path for a folder to display."
            "<p>To go to a folder previously entered, press the arrow on "
            "the right and choose one. <p>The entry has folder "
            "completion. Right-click to choose how completion should behave.") );
  QWhatsThis::add( filter,
        i18n("<p>Here you can enter a name filter to limit which files are displayed."
             "<p>To clear the filter, toggle off the filter button to the left."
             "<p>To reapply the last filter used, toggle on the filter button." ) );
  QWhatsThis::add( btnFilter,
        i18n("<p>This button clears the name filter when toggled off, or "
             "reapplies the last filter used when toggled on.") );

}
Beispiel #25
0
QSizePolicy MainWidget::sizePolicy() const
{
  return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
ScoreInfoDialog::ScoreInfoDialog(NMainFrameWidget *parent) :
	KDialogBase
		(Tabbed,                             //  dialogFace
		 kapp->makeStdCaption(i18n("Score information")),
		 Help | User1 | User2 | Ok | Apply | Cancel,
		 Ok,                                 //  defaultButton
		 parent,                             //  parent
		 "ScoreInfoDialog",                  //  name (for internal use only)
		 true,                               //  modal
		 true,                               //  separator
		 i18n("&Revert"),                    //  User1
		 i18n("Cl&ear all")                  //  User1
		),
	mainWidget(parent) {

	kapp->config()->setGroup("ScoreInfo");


	//  GENERAL

	QFrame *pageGeneral = addPage(i18n("&General"));
	QGridLayout *layoutGeneral = new QGridLayout(pageGeneral, 5, 2);
	layoutGeneral->setSpacing(KDialog::spacingHint());
	layoutGeneral->setColStretch(1 /* the right column */, 1 /*factor*/);

	//  Title
	title = new KHistoryCombo(pageGeneral);
	title->setHistoryItems(kapp->config()->readListEntry("TitleHistory"), true);
	title->setEditText(mainWidget->scTitle_);
	layoutGeneral->addWidget(title, 0, 1);
	QLabel *titleLabel = new QLabel(title, i18n("&Title:"), pageGeneral);
	layoutGeneral->addWidget(titleLabel, 0, 0);

	//  Subject
	subject = new KHistoryCombo(pageGeneral);
	subject->setHistoryItems
		(kapp->config()->readListEntry("SubjectHistory"), true);
	subject->setEditText(mainWidget->scSubtitle_);
	layoutGeneral->addWidget(subject, 1, 1);
	QLabel *subjectLabel = new QLabel(subject, i18n("&Subject:"), pageGeneral);
	layoutGeneral->addWidget(subjectLabel, 1, 0);

	//  Author
	author = new KHistoryCombo(pageGeneral);
	author->setHistoryItems
		(kapp->config()->readListEntry("AuthorHistory"), true);
	author->setEditText(mainWidget->scAuthor_);
	layoutGeneral->addWidget(author, 2, 1);
	QLabel *authorLabel = new QLabel(author, i18n("A&uthor:"), pageGeneral);
	layoutGeneral->addWidget(authorLabel, 2, 0);

	//  Last author
	lastAuthor = new KHistoryCombo(pageGeneral);
	lastAuthor->setHistoryItems
		(kapp->config()->readListEntry("LastAuthorHistory"), true);
	lastAuthor->setEditText(mainWidget->scLastAuthor_);
	layoutGeneral->addWidget(lastAuthor, 3, 1);
	QLabel *lastAuthorLabel = new QLabel
		(lastAuthor, i18n("&Last author:"), pageGeneral);
	layoutGeneral->addWidget(lastAuthorLabel, 3, 0);


	// Copyright
	copyright = new KHistoryCombo(pageGeneral);
	copyright->setHistoryItems
		(kapp->config()->readListEntry("Copyright"), true);
	copyright->setEditText(mainWidget->scCopyright_);
	layoutGeneral->addWidget(copyright, 4, 1);
	QLabel *copyrightLabel = new QLabel
		(lastAuthor, i18n("&Copyright:"), pageGeneral);
	layoutGeneral->addWidget(copyrightLabel, 4, 0);



	//  COMMENTS
	QGrid *pageComments = addGridPage(1, QGrid::Horizontal, i18n("Co&mments"));
	comments = new QMultiLineEdit(pageComments);
	comments->setText(mainWidget->scComment_);
	comments->setSizePolicy
		(QSizePolicy
			(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)
		);

	connect(this, SIGNAL(finished()), this, SLOT(saveComboData()));
	connect(this, SIGNAL(user2Clicked()), title,      SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), subject,    SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), author,     SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), lastAuthor, SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), copyright, SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), comments,   SLOT(clear()));
	connect(this, SIGNAL(okClicked()), this, SLOT(slotApply()));
	connect(this, SIGNAL(okClicked()), this, SLOT(hide()));

}
SetColValuesDialog::SetColValuesDialog( ScriptingEnv *env, QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl ), scripted(env)
{
    setName( "SetColValuesDialog" );
	setWindowTitle( tr( "QtiPlot - Set column values" ) );
	setSizeGripEnabled(true);
    setAttribute(Qt::WA_DeleteOnClose);

	QHBoxLayout *hbox1 = new QHBoxLayout();
	hbox1->addWidget(new QLabel(tr("For row (i)")));
	start = new QSpinBox();
	start->setMinValue(1);
    start->setMaxValue(INT_MAX);
	hbox1->addWidget(start);

	hbox1->addWidget(new QLabel(tr("to")));

	end = new QSpinBox();
	end->setMinValue(1);
    end->setMaxValue(INT_MAX);
	hbox1->addWidget(end);

	QGridLayout *gl1 = new QGridLayout();
	functions = new QComboBox(false);
	gl1->addWidget(functions, 0, 0);
	btnAddFunction = new QPushButton(tr( "Add function" ));
	gl1->addWidget(btnAddFunction, 0, 1);
	boxColumn = new QComboBox(false);
	gl1->addWidget(boxColumn, 1, 0);
	btnAddCol = new QPushButton(tr( "Add column" ));
	gl1->addWidget(btnAddCol, 1, 1);

	QHBoxLayout *hbox3 = new QHBoxLayout();
	hbox3->addStretch();
	buttonPrev = new QPushButton("&<<");
	hbox3->addWidget(buttonPrev);
	buttonNext = new QPushButton("&>>");
	hbox3->addWidget(buttonNext);
	gl1->addLayout(hbox3, 2, 0);
	addCellButton = new QPushButton(tr( "Add cell" ));
	gl1->addWidget(addCellButton, 2, 1);

	QGroupBox *gb = new QGroupBox();
	QVBoxLayout *vbox1 = new QVBoxLayout();
	vbox1->addLayout(hbox1);
	vbox1->addLayout(gl1);
	gb->setLayout(vbox1);
	gb->setSizePolicy(QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred));

	explain = new QTextEdit();
	explain->setReadOnly (true);
	explain->setSizePolicy(QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred));
	QPalette palette = explain->palette();
	palette.setColor(QPalette::Active, QPalette::Base, Qt::lightGray);
	explain->setPalette(palette);

	QHBoxLayout *hbox2 = new QHBoxLayout();
	hbox2->addWidget(explain);
	hbox2->addWidget(gb);

	commands = new ScriptEdit(scriptEnv);
	commands->setTabStopWidth(((ApplicationWindow *)parent)->d_notes_tab_length);
    commands->setFont(((ApplicationWindow *)parent)->d_notes_font);

	QVBoxLayout *vbox2 = new QVBoxLayout();
	btnApply = new QPushButton(tr( "&Apply" ));
	vbox2->addWidget(btnApply);
	buttonClearFormulas = new QPushButton(tr("Clear &Formulas" ));
	vbox2->addWidget(buttonClearFormulas);
	btnCancel = new QPushButton(tr( "&Close" ));
	vbox2->addWidget(btnCancel);
	vbox2->addStretch();

	QHBoxLayout *hbox4 = new QHBoxLayout();
	hbox4->addWidget(commands);
	hbox4->addLayout(vbox2);

	QVBoxLayout* vbox3 = new QVBoxLayout();
	vbox3->addLayout(hbox2);
#ifdef SCRIPTING_PYTHON
	boxMuParser = NULL;
	if (env->name() != QString("muParser")){
		boxMuParser = new QCheckBox(tr("Use built-in muParser (much faster)"));
		boxMuParser->setChecked(true);
		vbox3->addWidget(boxMuParser);
	}
#endif

	colNameLabel = new QLabel();
	vbox3->addWidget(colNameLabel);
	vbox3->addLayout(hbox4);

	setLayout(vbox3);
	setFocusProxy (commands);
	commands->setFocus();

	functions->insertStringList(scriptEnv->mathFunctions(), -1);
	if (functions->count() > 0)
		insertExplain(0);

	connect(btnAddFunction, SIGNAL(clicked()),this, SLOT(insertFunction()));
	connect(btnAddCol, SIGNAL(clicked()),this, SLOT(insertCol()));
	connect(addCellButton, SIGNAL(clicked()),this, SLOT(insertCell()));
	connect(btnApply, SIGNAL(clicked()),this, SLOT(apply()));
	connect(btnCancel, SIGNAL(clicked()),this, SLOT(close()));
	connect(functions, SIGNAL(activated(int)),this, SLOT(insertExplain(int)));
	connect(buttonPrev, SIGNAL(clicked()), this, SLOT(prevColumn()));
	connect(buttonNext, SIGNAL(clicked()), this, SLOT(nextColumn()));
	connect(buttonClearFormulas, SIGNAL(clicked()), this, SLOT(clearFormulas()));
}
Beispiel #28
0
HelpWindow::HelpWindow( const QString & home_, const QString & _path, QWidget * parent )
    : QMainWindow( parent ), pathCombo( 0 ), selectedURL()
{
    setWindowIcon( QPixmap( RingDir + "xdrawchem-icon.png" ) );

    browser = new QTextBrowser( this );

//    browser->setSearchPaths( _path );
    browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    connect( browser, SIGNAL( sourceChanged( const QUrl & ) ), this, SLOT( sourceChanged( const QUrl & ) ) );

    setCentralWidget( browser );

    if ( !home_.isEmpty() )
        browser->setSource( home_ );

    connect( browser, SIGNAL( highlighted( const QString & ) ), statusBar(), SLOT( showMessage( const QString & ) ) );

    resize( 640, 700 );

    QMenu *file = new QMenu( tr( "&File" ), this );

    file->addAction( tr( "&Print" ), this, SLOT( print() ), Qt::CTRL + Qt::Key_P );
    file->addSeparator();
    file->addAction( tr( "&Close" ), this, SLOT( close() ), Qt::CTRL + Qt::Key_W );

    // The same three icons are used twice each.
    QIcon icon_back( QPixmap( RingDir + "back.xpm" ) );
    QIcon icon_forward( QPixmap( RingDir + "forward.xpm" ) );
    QIcon icon_home( QPixmap( RingDir + "home.xpm" ) );

    QMenu *go = new QMenu( tr( "&Go" ), this );

    backwardAction = go->addAction( icon_back, tr( "&Backward" ), browser, SLOT( backward() ), Qt::CTRL + Qt::Key_Left );
    forwardAction = go->addAction( icon_forward, tr( "&Forward" ), browser, SLOT( forward() ), Qt::CTRL + Qt::Key_Right );
    homeAction = go->addAction( icon_home, tr( "&Home" ), browser, SLOT( home() ) );

    QMenu *help = new QMenu( tr( "&Help" ), this );

    help->addAction( tr( "&About ..." ), this, SLOT( about() ) );

    menuBar()->addMenu( file );
    menuBar()->addMenu( go );
    menuBar()->addMenu( help );

    forwardAction->setEnabled( FALSE );
    backwardAction->setEnabled( FALSE );

    connect( browser, SIGNAL( backwardAvailable( bool ) ), SLOT( setBackwardAvailable( bool ) ) );
    connect( browser, SIGNAL( forwardAvailable( bool ) ), SLOT( setForwardAvailable( bool ) ) );


    QToolBar *toolbar = new QToolBar( this );

    addToolBar( Qt::TopToolBarArea, toolbar );
//    QToolButton *button;

    toolbar->addAction( backwardAction );
    toolbar->addAction( forwardAction );
    toolbar->addAction( homeAction );

    toolbar->addSeparator();

    pathCombo = new QComboBox( toolbar );
    pathCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
    connect( pathCombo, SIGNAL( activated( const QString & ) ), SLOT( pathSelected( const QString & ) ) );

    toolbar->addWidget( pathCombo );
    pathCombo->addItem( home_ );
    browser->setFocus();

}
QSizePolicy RDMarkerBar::sizePolicy() const
{
  return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
Beispiel #30
0
 QSizePolicy sizePolicy() const
 {
     return QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
 }