コード例 #1
0
KLineEditDlg::KLineEditDlg( const QString&_text, const QString& _value,
                            QWidget *parent, bool _file_mode )
    : QDialog( parent, 0L, true )
{
    QGridLayout *layout = new QGridLayout(this, 4, 3, 10);

    QLabel *label = new QLabel(_text, this);
    layout->addWidget(label, 0, 0, AlignLeft);

    edit = new KLineEdit( this, 0L );
    edit->setMinimumWidth(edit->sizeHint().width() * 3);
    connect( edit, SIGNAL(returnPressed()), SLOT(accept()) );

    if ( _file_mode ) {
        completion = new KURLCompletion();
        edit->setCompletionObject( completion );
        edit->setAutoDeleteCompletionObject( true );
    } else
        completion = 0L;

    layout->addMultiCellWidget(edit, 1, 1, 0, _file_mode ? 1 : 2);
    layout->setColStretch(1, 1);

    if (_file_mode) {
        QPushButton *browse = new QPushButton(i18n("&Browse..."), this);
        layout->addWidget(browse, 1, 2, AlignCenter);
        connect(browse, SIGNAL(clicked()),
                SLOT(slotBrowse()));
    }

    QFrame *hLine = new QFrame(this);
    hLine->setFrameStyle(QFrame::Sunken|QFrame::HLine);
    layout->addMultiCellWidget(hLine, 2, 2, 0, 2);

    KButtonBox *bBox = new KButtonBox(this);
    layout->addMultiCellWidget(bBox, 3, 3, 0, 2);

    QPushButton *ok = bBox->addButton(KStdGuiItem::ok());
    ok->setDefault(true);
    connect( ok, SIGNAL(clicked()), SLOT(accept()));

    bBox->addStretch(1);

    QPushButton *clear = bBox->addButton(KStdGuiItem::clear());
    connect( clear, SIGNAL(clicked()), SLOT(slotClear()));

    bBox->addStretch(1);

    QPushButton *cancel = bBox->addButton(KStdGuiItem::cancel());
    connect( cancel, SIGNAL(clicked()), SLOT(reject()));

    bBox->layout();

    layout->activate();

    edit->setText( _value );
    edit->setSelection(0, edit->text().length());
    edit->setFocus();
}
コード例 #2
0
ファイル: SearchDlg.cpp プロジェクト: slimus/juffed
SearchDlg::SearchDlg(QWidget* parent) : QDialog(parent) {
    ui.setupUi(this);

    model_.setSorting(QDir::DirsFirst);
    ui.dirEd->setCompleter(new QCompleter(&model_));

    connect(ui.browseBtn, SIGNAL(clicked()), SLOT(slotBrowse()));

    ui.findInFilesFrame->hide();
}
コード例 #3
0
ファイル: SearchDlg.cpp プロジェクト: Mezomish/juffed
SearchDlg::SearchDlg(QWidget* parent) : QDialog(parent) {
	ui.setupUi(this);
	
    QCompleter *completer = new QCompleter(this);
    model = new QFileSystemModel(completer);
    model->setRootPath("");
    completer->setModel(model);
    ui.dirEd->setCompleter(completer);
	
	connect(ui.browseBtn, SIGNAL(clicked()), SLOT(slotBrowse()));
	
	ui.findInFilesFrame->hide();
}
コード例 #4
0
RubySupportPart::RubySupportPart(QObject *parent, const char *name, const QStringList& )
  : KDevLanguageSupport (&data, parent, name ? name : "RubySupportPart" )
{
  setInstance(RubySupportFactory::instance());
  setXMLFile("kdevrubysupport.rc");

  KAction *action;
  action = new KAction( i18n("&Run"), "exec", SHIFT + Key_F9,
                        this, SLOT(slotRun()),
                        actionCollection(), "build_execute" );
  action->setToolTip(i18n("Run"));
  action->setWhatsThis(i18n("<b>Run</b><p>Starts an application."));
  action->setIcon("ruby_run.png");

  action = new KAction( i18n("Run Test Under Cursor"), "exec", ALT + Key_F9,
                        this, SLOT(slotRunTestUnderCursor()),
                        actionCollection(), "build_execute_test_function" );
  action->setToolTip(i18n("Run Test Under Cursor"));
  action->setWhatsThis(i18n("<b>Run Test Under Cursor</b><p>Runs the function under the cursor as test."));

  action = new KAction( i18n("Launch Browser"), "network", 0, this, SLOT(slotBrowse()), actionCollection(), "build_launch_browser" );
  action->setToolTip(i18n("Launch Browser"));
  action->setWhatsThis(i18n("<b>Launch Browser</b><p>Opens a web browser pointing to the Ruby Rails server") );

  action = new KAction( i18n("Switch To Controller"), 0, CTRL+ALT+Key_1, this, SLOT(slotSwitchToController()), actionCollection(), "switch_to_controller" );
  action = new KAction( i18n("Switch To Model"), 0, CTRL+ALT+Key_2, this, SLOT(slotSwitchToModel()), actionCollection(), "switch_to_model" );
  action = new KAction( i18n("Switch To View"), 0, CTRL+ALT+Key_3, this, SLOT(slotSwitchToView()), actionCollection(), "switch_to_view" );
  action = new KAction( i18n("Switch To Test"), 0, CTRL+ALT+Key_4, this, SLOT(slotSwitchToTest()), actionCollection(), "switch_to_test" );

  kdDebug() << "Creating RubySupportPart" << endl;

  m_shellWidget = new KDevShellWidget( 0, "irb console");
  m_shellWidget->setIcon( SmallIcon("ruby_config.png", KIcon::SizeMedium, KIcon::DefaultState, RubySupportPart::instance()));
  m_shellWidget->setCaption(i18n("Ruby Shell"));
  mainWindow()->embedOutputView( m_shellWidget, i18n("Ruby Shell"), i18n("Ruby Shell"));
  mainWindow()->raiseView( m_shellWidget );

  connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) );
  connect( core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()) );
  connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)),
        this, SLOT(contextMenu(QPopupMenu *, const Context *)) );
  connect( partController(), SIGNAL(savedFile(const KURL&)),
  	this, SLOT(savedFile(const KURL&)) );
  connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)),
        this, SLOT(projectConfigWidget(KDialogBase*)) );
}
コード例 #5
0
ファイル: kimportdlg.cpp プロジェクト: CGenie/kmymoney
KImportDlg::KImportDlg(QWidget *parent)
    : KImportDlgDecl(parent)
{
  setModal(true);
  // Set all the last used options
  readConfig();

  loadProfiles(true);

  // load button icons
  m_qbuttonCancel->setGuiItem(KStandardGuiItem::cancel());

  KGuiItem okButtenItem(i18n("&Import"),
                        KIcon("document-import"),
                        i18n("Start operation"),
                        i18n("Use this to start the import operation"));
  m_qbuttonOk->setGuiItem(okButtenItem);

  KGuiItem browseButtenItem(i18n("&Browse..."),
                            KIcon("document-open"),
                            i18n("Select filename"),
                            i18n("Use this to select a filename to export to"));
  m_qbuttonBrowse->setGuiItem(browseButtenItem);

  KGuiItem newButtenItem(i18nc("New profile", "&New..."),
                         KIcon("document-new"),
                         i18n("Create a new profile"),
                         i18n("Use this to open the profile editor"));
  m_profileEditorButton->setGuiItem(newButtenItem);

  // connect the buttons to their functionality
  connect(m_qbuttonBrowse, SIGNAL(clicked()), this, SLOT(slotBrowse()));
  connect(m_qbuttonOk, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
  connect(m_qbuttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
  connect(m_profileEditorButton, SIGNAL(clicked()), this, SLOT(slotNewProfile()));

  // connect the change signals to the check slot and perform initial check
  connect(m_qlineeditFile, SIGNAL(textChanged(QString)), this,
          SLOT(slotFileTextChanged(QString)));

  // setup button enable status
  slotFileTextChanged(m_qlineeditFile->text());
}
コード例 #6
0
ファイル: kurllistrequester.cpp プロジェクト: aremai/krusader
KURLListRequester::KURLListRequester(Mode requestMode, QWidget *parent)
    : QWidget(parent), mode(requestMode)
{
    // Creating the widget

    QGridLayout *urlListRequesterGrid = new QGridLayout(this);
    urlListRequesterGrid->setSpacing(0);
    urlListRequesterGrid->setContentsMargins(0, 0, 0, 0);

    urlLineEdit = new KLineEdit(this);
    urlListRequesterGrid->addWidget(urlLineEdit, 0, 0);

    urlListBox = new KrListWidget(this);
    urlListBox->setSelectionMode(QAbstractItemView::ExtendedSelection);
    urlListRequesterGrid->addWidget(urlListBox, 1, 0, 1, 3);

    urlAddBtn = new QToolButton(this);
    urlAddBtn->setText("");
    urlAddBtn->setIcon(QIcon::fromTheme("arrow-down"));
    urlListRequesterGrid->addWidget(urlAddBtn, 0, 1);

    urlBrowseBtn = new QToolButton(this);
    urlBrowseBtn->setText("");
    urlBrowseBtn->setIcon(QIcon::fromTheme("folder"));
    urlListRequesterGrid->addWidget(urlBrowseBtn, 0, 2);

    // add shell completion

    completion.setMode(KUrlCompletion::FileCompletion);
    urlLineEdit->setCompletionObject(&completion);

    // connection table

    connect(urlAddBtn, SIGNAL(clicked()), this, SLOT(slotAdd()));
    connect(urlBrowseBtn, SIGNAL(clicked()), this, SLOT(slotBrowse()));
    connect(urlLineEdit, SIGNAL(returnPressed(const QString&)), this, SLOT(slotAdd()));
    connect(urlListBox, SIGNAL(itemRightClicked(QListWidgetItem *, const QPoint &)), this,
            SLOT(slotRightClicked(QListWidgetItem *, const QPoint &)));
    connect(urlLineEdit, SIGNAL(textChanged(const QString &)), this, SIGNAL(changed()));
}
ImageFileNameBrowserWidget::ImageFileNameBrowserWidget(QWidget* p,
        const QString& filter)
: QWidget(p),
_defaultPath(QString::null),
_filter(filter) {
    setLayout(new QHBoxLayout(this));
    _previewW = new QLabel(this);
    _previewW->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    _displayW = new QLineEdit(this);
    _displayW->setReadOnly(true);
    _browseW = new QPushButton(tr("..."), this);
    _removeW = new QPushButton(tr("Remove"), this);

    layout()->addWidget(_previewW);
    layout()->addWidget(_displayW);
    layout()->addWidget(_browseW);
    layout()->addWidget(_removeW);

    connect(_browseW, SIGNAL(clicked()), this, SLOT(slotBrowse()));
    connect(_removeW, SIGNAL(clicked()), this, SLOT(slotRemoveImageFileName()));
    connect(this, SIGNAL(fileNameChanged(const QString&)), this, SLOT(setImageFileName(const QString&)));
}
コード例 #8
0
ファイル: pathchooser.cpp プロジェクト: renatofilho/QtCreator
PathChooser::PathChooser(QWidget *parent) :
    QWidget(parent),
    m_d(new PathChooserPrivate(this))
{
    m_d->m_hLayout->setContentsMargins(0, 0, 0, 0);

    connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed()));
    connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed(QString)));
    connect(m_d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged()));
    connect(m_d->m_lineEdit, SIGNAL(validChanged(bool)), this, SIGNAL(validChanged(bool)));
    connect(m_d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));

    m_d->m_lineEdit->setMinimumWidth(200);
    m_d->m_hLayout->addWidget(m_d->m_lineEdit);
    m_d->m_hLayout->setSizeConstraint(QLayout::SetMinimumSize);

    addButton(tr(browseButtonLabel), this, SLOT(slotBrowse()));

    setLayout(m_d->m_hLayout);
    setFocusProxy(m_d->m_lineEdit);
    setEnvironment(Environment::systemEnvironment());
}
コード例 #9
0
CBuildToolbarsetDlg::CBuildToolbarsetDlg()
{
    m_ui.setupUi(this);
    setWindowIcon(QIcon(":/images/fmlideico.ico"));

    QDir destDir( FmlCoreSettings::getDataDir() );
    QString destDirPath = destDir.absolutePath();
    if( !destDir.exists( destDirPath ) )
        destDir.mkpath( destDirPath );
    m_ui.m_path->insert( destDirPath );

    destDir.setPath(FmlCoreSettings::getXmlBtnDir());
    destDirPath = destDir.absolutePath();
    if( !destDir.exists( destDirPath ) )
        destDir.mkpath( destDirPath );
#ifdef Q_WS_MAC
    QSettings settings(QSettings::IniFormat, QSettings::UserScope, __COMPANY_DOMAIN_, QCoreApplication::applicationName() );
#else
    QSettings settings(QSettings::IniFormat, QSettings::UserScope, __COMPANY_NAME__, QCoreApplication::applicationName() );
#endif
    QStringList files = settings.value("XmlBtn/recentFileList").toStringList();
    m_ui.m_src->addItems( files );

    if( m_ui.m_src->count() == 0 )
    {
        m_ui.btnDelete->setEnabled(false);
        m_ui.btnClear->setEnabled(false);
        m_ui.btnBuild->setEnabled(false);
    }
    m_ui.m_msg->setReadOnly(true);

    connect(m_ui.btnBrowse, SIGNAL(clicked()), this, SLOT(slotBrowse()));
    connect(m_ui.btnAdd, SIGNAL(clicked()), this, SLOT(slotAdd()));
    connect(m_ui.btnDelete, SIGNAL(clicked()), this, SLOT(slotDelete()));
    connect(m_ui.btnClear, SIGNAL(clicked()), this, SLOT(slotClear()));
    connect(m_ui.btnBuild, SIGNAL(clicked()), this, SLOT(slotBuild()));
}
コード例 #10
0
ファイル: importdialog.cpp プロジェクト: Kevinaw/simGUI
ImportDialog::ImportDialog(QWidget *parent)
		: QDialog(parent) //, 0, FALSE, Qt::WDestructiveClose)
{
  setWindowTitle(tr("Convert Data File..."));

  all = new QGridLayout(this);

  QGroupBox *Group2 = new QGroupBox(tr("File specification"),this);
  
  QGridLayout *file = new QGridLayout();
  file->addWidget(new QLabel(tr("Input File:")),0, 0);
  ImportEdit = new QLineEdit();
  file->addWidget(ImportEdit, 0, 1);
  QPushButton *BrowseButt = new QPushButton(tr("Browse"));
  file->addWidget(BrowseButt, 0, 2);
  connect(BrowseButt, SIGNAL(clicked()), SLOT(slotBrowse()));
  file->addWidget(new QLabel(tr("Output File:")), 1, 0);
  OutputEdit = new QLineEdit();
  file->addWidget(OutputEdit, 1, 1);
  OutputLabel = new QLabel(tr("Output Data:"));
  OutputLabel->setEnabled(false);
  file->addWidget(OutputLabel, 2, 0);
  OutputData = new QLineEdit();
  OutputData->setEnabled(false);
  file->addWidget(OutputData, 2, 1);
  OutType = new QComboBox();
  OutType->addItem(tr("Simgui dataset"));
  OutType->addItem(tr("Touchstone"));
  OutType->addItem(tr("CSV"));
  OutType->addItem(tr("Simgui library"));
  OutType->addItem(tr("Simgui netlist"));
  OutType->addItem(tr("Matlab"));
  connect(OutType, SIGNAL(activated(int)), SLOT(slotType(int)));
  file->addWidget(OutType, 2, 2);
  
  Group2->setLayout(file);
  all->addWidget(Group2, 0,0,1,1);
  
  QGroupBox *Group1 = new QGroupBox(tr("Messages"));
  
  QVBoxLayout *vMess = new QVBoxLayout();
  MsgText = new QTextEdit();
  vMess->addWidget(MsgText);
  MsgText->setTextFormat(Qt::PlainText);
  MsgText->setReadOnly(true);
  MsgText->setWordWrapMode(QTextOption::NoWrap);
  MsgText->setMinimumSize(250, 60);
  Group1->setLayout(vMess);
  all->addWidget(Group1, 1,0,1,1);

  QHBoxLayout *Butts = new QHBoxLayout();
  
  Butts->addStretch(5);
 
  ImportButt = new QPushButton(tr("Convert"));
  connect(ImportButt, SIGNAL(clicked()), SLOT(slotImport()));
  AbortButt = new QPushButton(tr("Abort"));
  AbortButt->setDisabled(true);
  connect(AbortButt, SIGNAL(clicked()), SLOT(slotAbort()));
  CancelButt = new QPushButton(tr("Close"));
  connect(CancelButt, SIGNAL(clicked()), SLOT(reject()));
  Butts->addWidget(ImportButt);
  Butts->addWidget(AbortButt);
  Butts->addWidget(CancelButt);
  
  all->addLayout(Butts,2,0,1,1);
}
コード例 #11
0
KXmlCommandSelector::KXmlCommandSelector(bool canBeNull, QWidget *parent, const char *name, KDialogBase *dlg) : QWidget(parent, name)
{
    m_cmd = new QComboBox(this);
    connect(m_cmd, SIGNAL(activated(int)), SLOT(slotCommandSelected(int)));
    QPushButton *m_add = new KPushButton(this);
    QPushButton *m_edit = new KPushButton(this);
    m_add->setPixmap(SmallIcon("filenew"));
    m_edit->setPixmap(SmallIcon("configure"));
    connect(m_add, SIGNAL(clicked()), SLOT(slotAddCommand()));
    connect(m_edit, SIGNAL(clicked()), SLOT(slotEditCommand()));
    QToolTip::add(m_add, i18n("New command"));
    QToolTip::add(m_edit, i18n("Edit command"));
    m_shortinfo = new QLabel(this);
    m_helpbtn = new KPushButton(this);
    m_helpbtn->setIconSet(SmallIconSet("help"));
    connect(m_helpbtn, SIGNAL(clicked()), SLOT(slotHelpCommand()));
    QToolTip::add(m_helpbtn, i18n("Information"));
    m_helpbtn->setEnabled(false);

    m_line = 0;
    m_usefilter = 0;
    QPushButton *m_browse = 0;

    QVBoxLayout *l0 = new QVBoxLayout(this, 0, 10);

    if(canBeNull)
    {
        m_line = new QLineEdit(this);
        m_browse = new KPushButton(KGuiItem(i18n("&Browse..."), "fileopen"), this);
        m_usefilter = new QCheckBox(i18n("Use co&mmand:"), this);
        connect(m_browse, SIGNAL(clicked()), SLOT(slotBrowse()));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_line, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_browse, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_cmd, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_add, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_edit, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_shortinfo, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), SLOT(slotXmlCommandToggled(bool)));
        m_usefilter->setChecked(true);
        m_usefilter->setChecked(false);
        // setFocusProxy(m_line);
        setTabOrder(m_usefilter, m_cmd);
        setTabOrder(m_cmd, m_add);
        setTabOrder(m_add, m_edit);

        QHBoxLayout *l1 = new QHBoxLayout(0, 0, 10);
        l0->addLayout(l1);
        l1->addWidget(m_line);
        l1->addWidget(m_browse);

        KSeparator *sep = new KSeparator(Qt::Horizontal, this);
        l0->addWidget(sep);
    }
    else
        setFocusProxy(m_cmd);

    QGridLayout *l2 = new QGridLayout(0, 2, (m_usefilter ? 3 : 2), 0, 5);
    int c(0);
    l0->addLayout(l2);
    if(m_usefilter)
    {
        l2->addWidget(m_usefilter, 0, c++);
    }
    l2->addWidget(m_cmd, 0, c);
    QHBoxLayout *l4 = new QHBoxLayout(0, 0, 5);
    l2->addLayout(l4, 1, c);
    l4->addWidget(m_helpbtn, 0);
    l4->addWidget(m_shortinfo, 1);
    QHBoxLayout *l3 = new QHBoxLayout(0, 0, 0);
    l2->addLayout(l3, 0, c + 1);
    l3->addWidget(m_add);
    l3->addWidget(m_edit);

    if(dlg)
        connect(this, SIGNAL(commandValid(bool)), dlg, SLOT(enableButtonOK(bool)));

    loadCommands();
}
コード例 #12
0
ファイル: packagedialog.cpp プロジェクト: AMDmi3/qucs
PackageDialog::PackageDialog(QWidget *parent_, bool create_)
			: QDialog(parent_) //, 0, TRUE, Qt::WDestructiveClose)
{
  all = new QVBoxLayout(this);
  all->setMargin(5);
  all->setSpacing(6);

  QHBoxLayout *h2 = new QHBoxLayout();

  if(create_) {  // create or extract package ?
    setWindowTitle(tr("Create Project Package"));

    QHBoxLayout *h1 = new QHBoxLayout();
    all->addLayout(h1);
    QLabel *packLabel = new QLabel(tr("Package:"));
    NameEdit = new QLineEdit();
    QPushButton *ButtBrowse = new QPushButton(tr("Browse"));
    connect(ButtBrowse, SIGNAL(clicked()), SLOT(slotBrowse()));
    h1->addWidget(packLabel);
    h1->addWidget(NameEdit);
    h1->addWidget(ButtBrowse);

    LibraryCheck = new QCheckBox(tr("include user libraries"));
    all->addWidget(LibraryCheck);

    Group = new QGroupBox(tr("Choose projects:"));
    all->addWidget(Group);
    
    QScrollArea *scrollArea = new QScrollArea(Group);
    scrollArea->setWidgetResizable(true);
    
    QWidget *scrollWidget = new QWidget();
    
    QVBoxLayout *checkBoxLayout = new QVBoxLayout();
    scrollWidget->setLayout(checkBoxLayout);
    scrollArea->setWidget(scrollWidget);
    
    QVBoxLayout *areaLayout = new QVBoxLayout();
    areaLayout->addWidget(scrollArea);
    Group->setLayout(areaLayout);
    
    // ...........................................................
    all->addLayout(h2);
    QPushButton *ButtCreate = new QPushButton(tr("Create"));
    h2->addWidget(ButtCreate);
    connect(ButtCreate, SIGNAL(clicked()), SLOT(slotCreate()));
    QPushButton *ButtCancel = new QPushButton(tr("Cancel"));
    h2->addWidget(ButtCancel);
    connect(ButtCancel, SIGNAL(clicked()), SLOT(reject()));

    // ...........................................................
    // insert all projects
    QStringList PrDirs = QucsSettings.QucsHomeDir.entryList("*", QDir::Dirs, QDir::Name);
    QStringList::iterator it;
    for(it = PrDirs.begin(); it != PrDirs.end(); it++)
       if((*it).right(4) == "_prj"){   // project directories end with "_prj"
         QCheckBox *subCheck = new QCheckBox((*it).left((*it).length()-4));
         checkBoxLayout->addWidget(subCheck);
         BoxList.append(subCheck);
       }
    
    //QColor theColor;
    if(BoxList.isEmpty()) {
      ButtCreate->setEnabled(false);
      //theColor =
      //   (new QLabel(tr("No projects!"), Dia_Box))->paletteBackgroundColor();
      QLabel *noProj = new QLabel(tr("No projects!"));
      checkBoxLayout->addWidget(noProj);              
    }
    //else
    //  theColor = BoxList.current()->paletteBackgroundColor();
    //Dia_Scroll->viewport()->setPaletteBackgroundColor(theColor);
  }

  else {  // of "if(create_)"
    setWindowTitle(tr("Extract Project Package"));

    MsgText = new QTextEdit(this);
    MsgText->setTextFormat(Qt::PlainText);
    MsgText->setWordWrapMode(QTextOption::NoWrap);
    MsgText->setReadOnly(true);
    all->addWidget(MsgText);

    all->addLayout(h2);
    h2->addStretch(5);
    ButtClose = new QPushButton(tr("Close"));
    h2->addWidget(ButtClose);
    ButtClose->setDisabled(true);
    connect(ButtClose, SIGNAL(clicked()), SLOT(accept()));

    resize(400, 250);
  }
}
コード例 #13
0
ファイル: vasettingsdialog.cpp プロジェクト: AMDmi3/qucs
VASettingsDialog::VASettingsDialog (TextDoc * Doc_)
  : QDialog (Doc_)
{
  Doc = Doc_;
  setWindowTitle(tr("Document Settings"));

  QString Module = Doc->getModuleName ();

  Expr.setPattern("[0-9a-zA-Z /\\]+"); // valid expression for IconEdit
  Validator = new QRegExpValidator (Expr, this);

  vLayout = new QVBoxLayout(this);
  
  QGroupBox * codeGroup = new QGroupBox (tr("Code Creation Settings"));
  vLayout->addWidget(codeGroup);
  QVBoxLayout *vbox = new QVBoxLayout();
  codeGroup->setLayout(vbox);
  
  QGridLayout * all = new QGridLayout ();
  vbox->addLayout(all);
  
  if (Doc->Icon.isEmpty ())
    Doc->Icon = Module + ".png";

  IconButt = new QLabel ();
  IconButt->setPixmap (QPixmap (Doc->Icon));
  all->addWidget (IconButt, 0, 0, 1, 1);

  IconEdit = new QLineEdit ();
  IconEdit->setValidator (Validator);
  IconEdit->setText (Doc->Icon);
  IconEdit->setCursorPosition (0);
  all->addWidget (IconEdit, 0, 1, 1, 3);
  
  BrowseButt = new QPushButton (tr("Browse"));
  connect (BrowseButt, SIGNAL (clicked()), SLOT (slotBrowse()));
  all->addWidget (BrowseButt, 0, 4, 1, 1);

  QLabel * l1 = new QLabel (tr("Output file:"));
  l1->setAlignment (Qt::AlignRight);
  all->addWidget (l1, 1, 0, 1, 1);
  OutputEdit = new QLineEdit ();
  OutputEdit->setText (Module + ".cpp");
  all->addWidget (OutputEdit, 1, 1, 1, 3);

  RecreateCheck = new QCheckBox (tr("Recreate"));
  all->addWidget (RecreateCheck, 1, 4, 1, 1);
  RecreateCheck->setChecked (Doc->recreate);

  if (Doc->ShortDesc.isEmpty ())
    Doc->ShortDesc = Module;

  QLabel * l2 = new QLabel (tr("Icon description:"));
  l2->setAlignment (Qt::AlignRight);
  all->addWidget (l2, 2, 0);
  ShortDescEdit = new QLineEdit ();
  ShortDescEdit->setText (Doc->ShortDesc);
  all->addWidget (ShortDescEdit, 2, 1, 1, 3);
  
  if (Doc->LongDesc.isEmpty ())
    Doc->LongDesc = Module + " verilog device";

  QLabel * l3 = new QLabel (tr("Description:"));
  l3->setAlignment (Qt::AlignRight);
  all->addWidget (l3, 3, 0);
  LongDescEdit = new QLineEdit ();
  LongDescEdit->setText (Doc->LongDesc);
  all->addWidget (LongDescEdit, 3, 1, 1, 3);

  toggleGroupDev = new QButtonGroup ();
  QRadioButton * nonRadio =
    new QRadioButton (tr("unspecified device"));
  QRadioButton * bjtRadio = 
    new QRadioButton (tr("NPN/PNP polarity"));
  QRadioButton * mosRadio =
    new QRadioButton (tr("NMOS/PMOS polarity"));
  toggleGroupDev->addButton(nonRadio, 0);
  toggleGroupDev->addButton(bjtRadio, DEV_BJT);
  toggleGroupDev->addButton(mosRadio, DEV_MOS);
  if (Doc->devtype & DEV_BJT)
    bjtRadio->setChecked (true);
  else if (Doc->devtype & DEV_MOS)
    mosRadio->setChecked (true);
  else
    nonRadio->setChecked (true);
  all->addMultiCellWidget (nonRadio, 4, 4, 0, 1);
  all->addWidget (bjtRadio, 4, 2);
  all->addMultiCellWidget (mosRadio, 4, 4, 3, 4);

  toggleGroupTyp = new QButtonGroup ();
  QRadioButton * anaRadio = 
    new QRadioButton (tr("analog only"));
  QRadioButton * digRadio =
    new QRadioButton (tr("digital only"));
  QRadioButton * allRadio =
    new QRadioButton (tr("both"));
  toggleGroupTyp->addButton(digRadio, DEV_DIG);
  toggleGroupTyp->addButton(anaRadio, DEV_ANA);
  toggleGroupTyp->addButton(allRadio, DEV_ALL);
  if ((Doc->devtype & DEV_ALL) == DEV_ALL)
    allRadio->setChecked (true);
  else if (Doc->devtype & DEV_ANA)
    anaRadio->setChecked (true);
  else
    digRadio->setChecked (true);
  all->addMultiCellWidget (anaRadio, 5, 5, 0, 1);
  all->addWidget (allRadio, 5, 2);
  all->addMultiCellWidget (digRadio, 5, 5, 3, 4);

  QHBoxLayout * Buttons = new QHBoxLayout ();
  vbox->addLayout(Buttons);
  QPushButton * ButtonOk = new QPushButton (tr("Ok"));
  Buttons->addWidget(ButtonOk);
  QPushButton * ButtonCancel = new QPushButton (tr("Cancel"));
  Buttons->addWidget(ButtonCancel);
  connect (ButtonOk, SIGNAL(clicked()), SLOT(slotOk()));
  connect (ButtonCancel, SIGNAL(clicked()), SLOT(reject()));
  ButtonOk->setDefault(true);
  
}