Exemplo n.º 1
0
void Tab::updateTitle(void) {
  QTabWidget* widget = qobject_cast<QTabWidget*>(parentWidget()->parentWidget());
  if(widget) {
    QString text = _webView->title();
    if(text.length() > 30) {
      text.truncate(28);
      text += "...";
    }
    widget->setTabText(widget->indexOf(this), text);
    widget->setTabToolTip(widget->indexOf(this), _webView->title());
  }
}
Exemplo n.º 2
0
void GCF::Components::MainWindow::showChildWidget(QWidget* parent, QWidget* child)
{
    if(!parent || !child)
        return;

    if(parent == d->workspace)
    {
        d->workspace->setCurrentWidget(child);
    }
    else
    {
        QList<QDockWidget*> dockWidgets = d->dockWidgetMap.values();
        QDockWidget* dw = qobject_cast<QDockWidget*>(parent);
        if(dw && dockWidgets.contains(dw))
        {
            QTabWidget* tw = qobject_cast<QTabWidget*>(dw->widget());
            int index = tw->indexOf(child);
            if(index < 0)
                child->show();
            else
            {
                child->setEnabled(true);
                tw->setCurrentWidget(child);
            }
        }
    }
}
Exemplo n.º 3
0
int ScriptToolbox::tabTabIndex(QWidget * tab, QWidget * page)
{
    QTabWidget *tw = qobject_cast<QTabWidget*>(tab);
    if(tw)
        return tw->indexOf(page);
    return 0;
}
Exemplo n.º 4
0
int QTabWidgetProto::indexOf(QWidget *w) const
{
  QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
  if (item)
    return item->indexOf(w);
  return 0;
}
Exemplo n.º 5
0
int TabWidget::indexOf ( lua_State * L )// (QWidget* w)const int
{
	QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
	QWidget* w = ObjectHelper<QWidget>::check( L, 2 );
	Util::push( L, obj->indexOf( w ) );
	return 1;
}
Exemplo n.º 6
0
void Tab::updateIcon(void) {
  QTabWidget* widget = qobject_cast<QTabWidget*>(parentWidget()->parentWidget());
  if(widget) {
    QIcon icon = _webView->icon();
    if(icon.isNull()) {
      icon = QIcon(":/defaultPageIcon.png");
    }
    widget->setTabIcon(widget->indexOf(this), icon);
  }
}
Exemplo n.º 7
0
void
WFile::update_label()
{
	QTabWidget *tabs = main_ui_->tabs;
	QString label = QFileInfo(file()->filename()).fileName();
	if (label.isEmpty())
		label = "Untitled";
	if (!file()->saved())
		label = "* " + label;
	tabs->setTabText(tabs->indexOf(this), label);
}
Exemplo n.º 8
0
 void retranslateUi(QDialog *MemberEditDialog)
 {
     MemberEditDialog->setWindowTitle(QApplication::translate("MemberEditDialog", "Dialog", 0));
     titleLabel->setText(QApplication::translate("MemberEditDialog", "Title", 0));
     firstNameLabel->setText(QApplication::translate("MemberEditDialog", "First Name", 0));
     lastNameLabel->setText(QApplication::translate("MemberEditDialog", "Last Name", 0));
     streetLabel->setText(QApplication::translate("MemberEditDialog", "Street", 0));
     zipLabel->setText(QApplication::translate("MemberEditDialog", "Zip", 0));
     numberLabel->setText(QApplication::translate("MemberEditDialog", "Nr.", 0));
     cityLabel->setText(QApplication::translate("MemberEditDialog", "City", 0));
     comboBox->clear();
     comboBox->insertItems(0, QStringList()
      << QString()
      << QApplication::translate("MemberEditDialog", "Herr", 0)
      << QApplication::translate("MemberEditDialog", "Frau", 0)
     );
     maritalCBox->clear();
     maritalCBox->insertItems(0, QStringList()
     	<< QString()
     	<< QApplication::translate("MemberEditDialog", "Ledig", 0)
     	<< QApplication::translate("MemberEditDialog", "Verheiratet", 0)
     );
     titleExtLabel->setText(QString());
     phoneLabel->setText(QApplication::translate("MemberEditDialog", "Phone", 0));
     cellLabel->setText(QApplication::translate("MemberEditDialog", "Mobile Phone", 0));
     emailLabel->setText(QApplication::translate("MemberEditDialog", "E-Mail", 0));
     maritalLabel->setText(QApplication::translate("MemberEditDialog", "Stand", 0));
     tabWidget->setTabText(tabWidget->indexOf(generalTab), QApplication::translate("MemberEditDialog", "General", 0));
     ibanLabel->setText(QApplication::translate("MemberEditDialog", "IBAN", 0));
     bicLabel->setText(QApplication::translate("MemberEditDialog", "BIC", 0));
     ownerLabel->setText(QApplication::translate("MemberEditDialog", "Owner", 0));
     noteLabel->setText(QApplication::translate("MemberEditDialog", "Note", 0));
     addButton->setText(QApplication::translate("MemberEditDialog", "Add", 0));
     editButton->setText(QApplication::translate("MemberEditDialog", "Edit", 0));
     deleteButton->setText(QApplication::translate("MemberEditDialog", "Delete", 0));
     tabWidget->setTabText(tabWidget->indexOf(accountTab), QApplication::translate("MemberEditDialog", "Account", 0));
     okButton->setText(QApplication::translate("MemberEditDialog", "Ok", 0));
     applyButton->setText(QApplication::translate("MemberEditDialog", "Apply", 0));
     leaveButton->setText(QApplication::translate("MemberEditDialog", "Austritt", 0));
     cancelButton->setText(QApplication::translate("MemberEditDialog", "Cancel", 0));
 } // retranslateUi
Exemplo n.º 9
0
void ConfigurationManager::initTabIcons()
{
    QTabWidget *tw = ui->tabWidget;
    if ( !tw->tabIcon(0).isNull() )
        return;

    tw->setTabIcon( tw->indexOf(ui->tabGeneral), getIcon("", IconWrench) );
    tw->setTabIcon( tw->indexOf(ui->tabLayout), getIcon("", IconColumns) );
    tw->setTabIcon( tw->indexOf(ui->tabHistory), getIcon("", IconListAlt) );
    tw->setTabIcon( tw->indexOf(ui->tabItems), getIcon("", IconThList) );
    tw->setTabIcon( tw->indexOf(ui->tabTray), getIcon("", IconInbox) );
    tw->setTabIcon( tw->indexOf(ui->tabNotifications), getIcon("", IconInfoCircle) );
    tw->setTabIcon( tw->indexOf(ui->tabShortcuts), getIcon("", IconKeyboard) );
    tw->setTabIcon( tw->indexOf(ui->tabAppearance), getIcon("", IconImage) );
}
Exemplo n.º 10
0
bool CGraphicsBank::onNameChanged(QString newName)
{
   if (m_name != newName)
   {
      m_name = newName;

      if ( m_editor )
      {
         QTabWidget* tabWidget = (QTabWidget*)m_editor->parentWidget()->parentWidget();
         tabWidget->setTabText(tabWidget->indexOf(m_editor), newName);
      }
   }

   return true;
}
Exemplo n.º 11
0
QWidget *TilesetItemBox::makeCategory(const QString &categoryItem)
{
    QTabWidget *TileSetsCategories = ui->TileSetsCategories;
    QWidget *catWid;
    QWidget *scrollWid;
    QGridLayout *catLayout;
    QLabel *grpLabel;
    QComboBox *tilesetGroup;
    QSpacerItem *spItem;
    QScrollArea *TileSets;
    FlowLayout *theLayOut;


    catWid = new QWidget();
    scrollWid = new QWidget();
    catLayout = new QGridLayout(catWid);
    catLayout->setSpacing(0);
    catLayout->setContentsMargins(0, 0, 0, 0);
    grpLabel = new QLabel(catWid);
    grpLabel->setText(tr("Group:"));
    catLayout->addWidget(grpLabel, 0, 0, 1, 1);

    tilesetGroup = new QComboBox(catWid);

    catLayout->addWidget(tilesetGroup, 0, 1, 1, 1);
    tilesetGroup->setInsertPolicy(QComboBox::InsertAlphabetically);
    spItem = new QSpacerItem(1283, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    catLayout->addItem(spItem, 0, 2, 1, 1);
    TileSets = new QScrollArea(catWid);
    TileSets->setWidget(scrollWid);
    TileSets->setWidgetResizable(true);
    TileSets->setFrameShape(QFrame::StyledPanel);
    TileSets->setFrameShadow(QFrame::Raised);
    TileSets->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    TileSets->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    theLayOut = new FlowLayout(scrollWid);
    theLayOut->setSizeConstraint(QLayout::SetNoConstraint);

    catLayout->addWidget(TileSets, 1, 0, 1, 3);

    TileSetsCategories->addTab(catWid, QString());
    TileSetsCategories->setTabText(TileSetsCategories->indexOf(catWid), categoryItem);

    return catWid;
}
Exemplo n.º 12
0
void NotepadForm::jumptab()
{
	if (parent())
	{
		QTabWidget* p = qobject_cast<QTabWidget*>(parent()->parent());
		if (p)
		{
			qint32 max = p->count();
			qint32 cur = p->indexOf(this);

			if (sender()->objectName().startsWith('n')) {
				if (++cur >= max) cur = 0;
			} else {
				if (--cur < 0) cur = (max>0) ? (max-1) : 0;
			}

			p->setCurrentIndex(cur);
		}
	}
}
Exemplo n.º 13
0
void CGraphicsBank::contextMenuEvent(QContextMenuEvent* event, QTreeView* parent)
{
   const QString EXPORT_PNG_TEXT    = "Export as PNG";
   const QString DELETE_TEXT        = "&Delete";

   QMenu menu(parent);
   menu.addAction(EXPORT_PNG_TEXT);
   menu.addSeparator();
   menu.addAction(DELETE_TEXT);

   QAction* ret = menu.exec(event->globalPos());

   if (ret)
   {
      if (ret->text() == DELETE_TEXT)
      {
         if (QMessageBox::question(parent, "Delete Source", "Are you sure you want to delete " + caption(),
                                   QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
         {
            return;
         }

         if (m_editor)
         {
            QTabWidget* tabWidget = (QTabWidget*)this->m_editor->parentWidget()->parentWidget();
            tabWidget->removeTab(tabWidget->indexOf(m_editor));
         }

         // TODO: Fix this logic so the memory doesn't get lost.
         nesicideProject->getProject()->getGraphicsBanks()->removeChild(this);
         nesicideProject->getProject()->getGraphicsBanks()->getGraphicsBanks().removeAll(this);
         //((CProjectTreeViewModel*)parent->model())->layoutChangedEvent();
      }
      else if (ret->text() == EXPORT_PNG_TEXT)
      {
         exportAsPNG();
      }
   }
}
Exemplo n.º 14
0
void JabberInfo::apply()
{
    if ((m_data == NULL) && (m_client->getState() == Client::Connected)){
        QString errMsg;
        QWidget *errWidget = edtCurrent;
        if (!edtPswd1->text().isEmpty() || !edtPswd2->text().isEmpty()){
            if (edtCurrent->text().isEmpty()){
                errMsg = i18n("Input current password");
            }else{
                if (edtPswd1->text() != edtPswd2->text()){
                    errMsg = i18n("Confirm password does not match");
                    errWidget = edtPswd2;
                }else if (edtCurrent->text() != m_client->getPassword()){
                    errMsg = i18n("Invalid password");
                }
            }
        }
        if (!errMsg.isEmpty()){
            for (QWidget *p = parentWidget(); p; p = p->parentWidget()){
                QTabWidget *tb = qobject_cast<QTabWidget*>(p);
                if (!tb)
                    continue;
                tb->setCurrentIndex(tb->indexOf(this));
                break;
            }
            emit raise(this);
            BalloonMsg::message(errMsg, errWidget);
            return;
        }
        if (!edtPswd1->text().isEmpty())
            m_client->changePassword(edtPswd1->text());
        // clear Textboxes
        edtCurrent->clear();
        edtPswd1->clear();
        edtPswd2->clear();
    }
}
Exemplo n.º 15
0
void GCF::Components::MainWindow::hideChildWidget(QWidget* parent, QWidget* child)
{
    if(!parent || !child)
        return;

    if(parent == d->workspace)
    {
        // widgets on the workspace are not hidden or shown
    }
    else
    {
        QList<QDockWidget*> dockWidgets = d->dockWidgetMap.values();
        QDockWidget* dw = qobject_cast<QDockWidget*>(parent);
        if(dw && dockWidgets.contains(dw))
        {
            QTabWidget* tw = qobject_cast<QTabWidget*>(dw->widget());
            int index = tw->indexOf(child);
            if(index < 0)
                child->hide();
            else
                child->setEnabled(false);
        }
    }
}
Exemplo n.º 16
0
ConfigurationManager::ConfigurationManager()
    : QDialog()
    , ui(new Ui::ConfigurationManager)
    , m_datfilename()
    , m_options()
    , m_theme()
    , m_commands()
{
    ui->setupUi(this);

    ui->scrollAreaCommand->hide();

    ClipboardBrowser *c = ui->clipboardBrowserPreview;
    c->addItems( QStringList()
                 << tr("Search string is \"item\".")
                 << tr("Select an item and\n"
                       "press F2 to edit.")
                 << tr("Select items and move them with\n"
                       "CTRL and up or down key.")
                 << tr("Remove item with Delete key.")
                 << tr("Example item %1").arg(1)
                 << tr("Example item %1").arg(2)
                 << tr("Example item %1").arg(3) );
    c->filterItems( tr("item") );

#ifdef NO_GLOBAL_SHORTCUTS
    ui->tabShortcuts->deleteLater();
#endif

    Command cmd;
    int i = 0;
    QMenu *menu = new QMenu(ui->toolButtonAddCommand);
    ui->toolButtonAddCommand->setMenu(menu);
    while ( defaultCommand(++i, &cmd) ) {
        menu->addAction( IconFactory::iconFromFile(cmd.icon), cmd.name.remove('&') )
                ->setProperty("COMMAND", i);
    }

    /* general options */
    m_options["maxitems"] = Option(200, "value", ui->spinBoxItems);
    m_options["editor"] = Option(DEFAULT_EDITOR, "text", ui->lineEditEditor);
    m_options["edit_ctrl_return"] = Option(true, "checked", ui->checkBoxEditCtrlReturn);
    m_options["check_clipboard"] = Option(true, "checked", ui->checkBoxClip);
    m_options["confirm_exit"] = Option(true, "checked", ui->checkBoxConfirmExit);
    m_options["vi"] = Option(false, "checked", ui->checkBoxViMode);
    m_options["always_on_top"] = Option(false, "checked", ui->checkBoxAlwaysOnTop);
    m_options["tab_position"] = Option(0, "currentIndex", ui->comboBoxTabPosition);
    m_options["text_wrap"] = Option(true, "checked", ui->checkBoxTextWrap);

    m_options["tray_items"] = Option(5, "value", ui->spinBoxTrayItems);
    m_options["tray_commands"] = Option(true, "checked", ui->checkBoxTrayShowCommands);
    m_options["tray_tab_is_current"] = Option(true, "checked", ui->checkBoxMenuTabIsCurrent);
    m_options["tray_images"] = Option(true, "checked", ui->checkBoxTrayImages);
    m_options["tray_tab"] = Option("", "text", ui->comboBoxMenuTab->lineEdit());

    // Tooltip to show on command line.
    ui->comboBoxMenuTab->lineEdit()->setToolTip( ui->comboBoxMenuTab->toolTip() );

    /* other options */
    m_options["tabs"] = Option(QStringList());
    m_options["command_history_size"] = Option(100);
    m_options["_last_hash"] = Option(0);
#ifndef NO_GLOBAL_SHORTCUTS
    /* shortcuts */
    m_options["toggle_shortcut"] = Option("", "text", ui->pushButton);
    m_options["menu_shortcut"] = Option("", "text", ui->pushButton_2);
    m_options["edit_clipboard_shortcut"] = Option("", "text", ui->pushButton_3);
    m_options["edit_shortcut"] = Option("", "text", ui->pushButton_4);
    m_options["second_shortcut"] = Option("", "text", ui->pushButton_5);
    m_options["show_action_dialog"] = Option("", "text", ui->pushButton_6);
    m_options["new_item_shortcut"] = Option("", "text", ui->pushButton_7);
#endif
#ifdef COPYQ_WS_X11
    /* X11 clipboard selection monitoring and synchronization */
    m_options["check_selection"] = Option(true, "checked", ui->checkBoxSel);
    m_options["copy_clipboard"] = Option(true, "checked", ui->checkBoxCopyClip);
    m_options["copy_selection"] = Option(true, "checked", ui->checkBoxCopySel);
#else
    ui->checkBoxCopySel->hide();
    ui->checkBoxSel->hide();
    ui->checkBoxCopyClip->hide();
#endif

    // values of last submitted action
    m_options["action_has_input"]  = Option(false);
    m_options["action_has_output"] = Option(false);
    m_options["action_separator"]  = Option("\\n");
    m_options["action_output_tab"] = Option("");

    /* appearance options */
    QString name;
    QPalette p;
    name = p.color(QPalette::Base).name();
    m_theme["bg"]          = Option(name, "VALUE", ui->pushButtonColorBg);
    m_theme["edit_bg"]     = Option(name, "VALUE", ui->pushButtonColorEditorBg);
    name = p.color(QPalette::Text).name();
    m_theme["fg"]          = Option(name, "VALUE", ui->pushButtonColorFg);
    m_theme["edit_fg"]     = Option(name, "VALUE", ui->pushButtonColorEditorFg);
    name = p.color(QPalette::Text).lighter(400).name();
    m_theme["num_fg"]      = Option(name, "VALUE", ui->pushButtonColorNumberFg);
    name = p.color(QPalette::AlternateBase).name();
    m_theme["alt_bg"]      = Option(name, "VALUE", ui->pushButtonColorAltBg);
    name = p.color(QPalette::Highlight).name();
    m_theme["sel_bg"]      = Option(name, "VALUE", ui->pushButtonColorSelBg);
    name = p.color(QPalette::HighlightedText).name();
    m_theme["sel_fg"]      = Option(name, "VALUE", ui->pushButtonColorSelFg);
    m_theme["find_bg"]     = Option("#ff0", "VALUE", ui->pushButtonColorFindBg);
    m_theme["find_fg"]     = Option("#000", "VALUE", ui->pushButtonColorFindFg);
    m_theme["font"]        = Option("", "VALUE", ui->pushButtonFont);
    m_theme["edit_font"]   = Option("", "VALUE", ui->pushButtonEditorFont);
    m_theme["find_font"]   = Option("", "VALUE", ui->pushButtonFoundFont);
    m_theme["num_font"]    = Option("", "VALUE", ui->pushButtonNumberFont);
    m_theme["show_number"] = Option(true, "checked", ui->checkBoxShowNumber);
    m_theme["show_scrollbars"] = Option(true, "checked", ui->checkBoxScrollbars);

    m_options["use_system_icons"] = Option(false, "checked", ui->checkBoxSystemIcons);

    /* datafile for items */
    QSettings settings(QSettings::IniFormat, QSettings::UserScope,
                       QCoreApplication::organizationName(),
                       QCoreApplication::applicationName());
    const QString settingsFileName = settings.fileName();
    m_datfilename = settingsFileName;
    m_datfilename.replace( QRegExp(".ini$"), QString("_tab_") );

    // Create directory to save items (otherwise it may not exist at time of saving).
    QDir settingsDir(settingsFileName + "/..");
    if ( settingsDir.mkdir(".") ) {
        log( tr("Cannot create directory for settings \"%1\"!").arg(settingsDir.path()),
             LogError );
    }

    connect(this, SIGNAL(finished(int)), SLOT(onFinished(int)));

    // Tab icons
    QTabWidget *tw = ui->tabWidget;
    tw->setTabIcon( tw->indexOf(ui->tabClipboard), getIcon("", IconPaste) );
    tw->setTabIcon( tw->indexOf(ui->tabGeneral), getIcon("", IconListOl) );
    tw->setTabIcon( tw->indexOf(ui->tabTray), getIcon("", IconInbox) );
    tw->setTabIcon( tw->indexOf(ui->tabCommands), getIcon("", IconCogs) );
    tw->setTabIcon( tw->indexOf(ui->tabShortcuts), getIcon("", IconHandUp) );
    tw->setTabIcon( tw->indexOf(ui->tabAppearance), getIcon("", IconPicture) );

    loadSettings();
}
Exemplo n.º 17
0
int drv_tabwidget(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QTabWidget *self = (QTabWidget*)head->native;
    switch (drvid) {
    case TABWIDGET_INIT: {
        drvNewObj(a0,new QTabWidget);
        break;
    }
    case TABWIDGET_ADDTAB: {
        self->addTab(drvGetWidget(a1),drvGetString(a2));
        break;
    }
    case TABWIDGET_CLEAR: {
        self->clear();
        break;
    }
    case TABWIDGET_COUNT: {
        drvSetInt(a1,self->count());
        break;
    }
    case TABWIDGET_CURRENTINDEX: {
        drvSetInt(a1,self->currentIndex());
        break;
    }
    case TABWIDGET_CURRENTWIDGET: {
        drvSetHandle(a1,self->currentWidget());
        break;
    }
    case TABWIDGET_SETCURRENTINDEX: {
        self->setCurrentIndex(drvGetInt(a1));
        break;
    }
    case TABWIDGET_SETCURRENTWIDGET: {
        self->setCurrentWidget(drvGetWidget(a1));
        break;
    }
    case TABWIDGET_INDEXOF: {
        drvSetInt(a2,self->indexOf(drvGetWidget(a1)));
        break;
    }
    case TABWIDGET_INSERTTAB: {
        self->insertTab(drvGetInt(a1),drvGetWidget(a2),drvGetString(a3));
        break;
    }
    case TABWIDGET_REMOVETAB: {
        self->removeTab(drvGetInt(a1));
        break;
    }
    case TABWIDGET_SETTABTEXT: {
        self->setTabText(drvGetInt(a1),drvGetString(a2));
        break;
    }
    case TABWIDGET_SETTABTOOLTIP: {
        self->setTabToolTip(drvGetInt(a1),drvGetString(a2));
        break;
    }
    case TABWIDGET_TABTEXT: {
        drvSetString(a2,self->tabText(drvGetInt(a1)));
        break;
    }
    case TABWIDGET_TABTOOLTIP: {
        drvSetString(a2,self->tabToolTip(drvGetInt(a1)));
        break;
    }
    case TABWIDGET_WIDGETOF: {
        drvSetHandle(a2,self->widget(drvGetInt(a1)));
        break;
    }
    case TABWIDGET_ONCURRENTCHANGED: {
        QObject::connect(self,SIGNAL(currentChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemplo n.º 18
0
int YaTabBarBase::indexOf(TabbableWidget* tab) const
{
	QTabWidget* tabWidget = dynamic_cast<QTabWidget*>(parentWidget());
	Q_ASSERT(tabWidget);
	return tabWidget ? tabWidget->indexOf(tab) : -1;
}
NLSimpleGuiWindow::NLSimpleGuiWindow( NLSimple *model, QWidget *parent)
    : QMainWindow(parent), ui(new Ui::NLSimpleGuiWindow), m_model(model),
      m_ownsModel(model==NULL), m_fileName(""), m_equationPt(NULL),
      m_programOptionsGui(NULL)
{
  ui->setupUi(this);
  if( !m_model ) openNewModel();
  if( !m_model ) quit();

  QMenu *fileMenu = ui->menuBar->addMenu( "&File" );
  QAction *newAction = fileMenu->addAction( "&new model" );
  QAction *openAction = fileMenu->addAction( "&open file" );
  QAction *saveAction = fileMenu->addAction( "&save" );
  QAction *saveAsAction = fileMenu->addAction( "save &as" );
  QAction *quitAction = fileMenu->addAction( "&quit" );

  connect( newAction, SIGNAL(triggered()), this, SLOT(openNewModel()) );
  connect( openAction, SIGNAL(triggered()), this, SLOT(openExistingModel()) );
  connect( saveAction, SIGNAL(triggered()), this, SLOT(saveModel()) );
  connect( saveAsAction, SIGNAL(triggered()), this, SLOT(saveModelAs()) );
  connect( quitAction, SIGNAL(triggered()), this, SLOT(quit()) );


  TCanvas *can = ui->m_mathFormulaWidget->GetCanvas();
  can->cd();
  can->SetEditable( kTRUE );
  m_equationPt = new TPaveText(0, 0, 1.0, 1.0, "NDC");
  m_equationPt->SetBorderSize(0);
  m_equationPt->SetTextAlign(12);
  m_equationPt->Draw();
  can->SetEditable( kFALSE );
  can->Update();


  //Add a button group so CLarke Error Grid buttons are mutually exclusive
  m_clarkeButtonGroup = new QButtonGroup( this );
  m_clarkeButtonGroup->addButton( ui->clarkCgmsVMeterRadioButton, 0 );
  m_clarkeButtonGroup->addButton( ui->clarkePredVCGMSRadioButton, 1 );
  ui->clarkCgmsVMeterRadioButton->setChecked(true);
  connect( m_clarkeButtonGroup, SIGNAL(buttonClicked(int)),
          this, SLOT(refreshClarkAnalysis()) );

  //Make so Clarke Grid displays nice
  can = ui->clarkeErrorGridWidget->GetCanvas();
  can->cd();
  can->Range(-45.17185,-46.4891,410.4746,410.6538);
  can->SetFillColor(0);
  can->SetBorderMode(0);
  can->SetBorderSize(2);
  can->SetRightMargin(0.031);
  can->SetTopMargin(0.024);
  can->SetFrameBorderMode(0);

  QTabWidget *tw = ui->tabWidget;
  tw->setTabText( tw->indexOf(ui->modelDisplyTab), "Display"    );
  tw->setTabText( tw->indexOf(ui->optionsTab),     "Options"    );
  tw->setTabText( tw->indexOf(ui->clarkeGridTab),  "Error Grid" );
  tw->setTabText( tw->indexOf(ui->customEventsTab),  "Custom Events" );

  ui->endDisplayTime->setCalendarPopup(true);
  ui->startDisplayTime->setCalendarPopup(true);
  // ui->endDisplayTime->setDisplayFormat("MMM dd yy hh:mm AP");
  // ui->startDisplayTime->setDisplayFormat("MMM dd yy hh:mm AP");

  ui->tabWidget->setCurrentWidget(ui->customEventsTab);
  m_customEventList = new QStandardItemModel(this/*ui->customEventLayout*/);

  ui->customEventView->setModel(m_customEventList);
  ui->customEventView->setShowGrid(false);
  ui->customEventView->setAlternatingRowColors(true);
  ui->customEventView->horizontalHeader()->setHidden(false);


  connect( ui->geneticOptimizeButton, SIGNAL(clicked()), this, SLOT(doGeneticOptimization()) );
  connect( ui->baysianFineTuneButton, SIGNAL(clicked()), this, SLOT(doMinuit2Fit())          );
  connect( ui->addCgmsButton,         SIGNAL(clicked()), this, SLOT(addCgmsData())           );
  connect( ui->addMealDataButton,     SIGNAL(clicked()), this, SLOT(addCarbData())           );
  connect( ui->addMeterDataButton,    SIGNAL(clicked()), this, SLOT(addMeterData())          );
  connect( ui->addCustonDataBustom,   SIGNAL(clicked()), this, SLOT(addCustomEventData())    );
  connect( ui->redrawButton,          SIGNAL(clicked()), this, SLOT(drawModel())             );
  connect( ui->zoomIn,                SIGNAL(clicked()), this, SLOT(zoomModelPreviewPlus())  );
  connect( ui->zoomOut,               SIGNAL(clicked()), this, SLOT(zoomModelPreviewMinus()) );
  connect( ui->zoomIn,                SIGNAL(clicked()), this, SLOT(zoomModelPreviewPlus())  );
  connect( ui->endDisplayTime,        SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(checkDisplayTimeLimitsConsistency()) );
  connect( ui->startDisplayTime,      SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(checkDisplayTimeLimitsConsistency()) );
  connect( ui->endDisplayTime,        SIGNAL(editingFinished()), this, SLOT(drawModel())    );
  connect( ui->startDisplayTime,      SIGNAL(editingFinished()), this, SLOT(drawModel())    );
  connect( ui->addCustomEventButton,  SIGNAL(clicked()),         this, SLOT(addCustomEventDef())    );
  connect( ui->deleteCustoEvenButton, SIGNAL(clicked()),         this, SLOT(deleteCustomEventDef()) );
  connect( ui->customEventView,       SIGNAL(clicked(QModelIndex)), this, SLOT(drawSelectedCustomEvent()) );
  init();
}//NLSimpleGuiWindow constructor
Exemplo n.º 20
-1
void GCF::Components::MainWindow::removeChildWidget(QWidget* parent, QWidget* child)
{
    if(!parent || !child)
        return;

    if(parent == d->workspace)
    {
        d->workspace->removeTab(d->workspace->indexOf(child));
        child->removeEventFilter(this);
    }
    else
    {
        QList<QDockWidget*> dockWidgets = d->dockWidgetMap.values();
        QDockWidget* dw = qobject_cast<QDockWidget*>(parent);
        if(dw && dockWidgets.contains(dw))
        {
            QTabWidget* tw = qobject_cast<QTabWidget*>(dw->widget());
            tw->removeTab(tw->indexOf(child));
            if(tw->count())
                dw->show();
            else
                dw->hide();
        }
    }
}