void tst_QWidget_window::tst_windowFilePathAndwindowTitle()
{
    QFETCH(bool, setWindowTitleBefore);
    QFETCH(bool, setWindowTitleAfter);
    QFETCH(QString, filePath);
    QFETCH(QString, applicationName);
    QFETCH(QString, indyWindowTitle);
    QFETCH(QString, finalTitleBefore);
    QFETCH(QString, finalTitleAfter);


    QWidget widget;
    QCOMPARE(widget.windowFilePath(), QString());

    if (!applicationName.isEmpty())
        qApp->setApplicationName(applicationName);
    else
        qApp->setApplicationName(QString());

    if (setWindowTitleBefore) {
        widget.setWindowTitle(indyWindowTitle);
    }
    widget.setWindowFilePath(filePath);
    QCOMPARE(finalTitleBefore, widget.windowTitle());
    QCOMPARE(widget.windowFilePath(), filePath);

    if (setWindowTitleAfter) {
        widget.setWindowTitle(indyWindowTitle);
    }
    QCOMPARE(finalTitleAfter, widget.windowTitle());
    QCOMPARE(widget.windowFilePath(), filePath);
}
TaskDialogPython::TaskDialogPython(const Py::Object& o) : dlg(o)
{
    if (dlg.hasAttr(std::string("ui"))) {
        UiLoader loader;
#if QT_VERSION >= 0x040500
        loader.setLanguageChangeEnabled(true);
#endif
        QString fn, icon;
        Py::String ui(dlg.getAttr(std::string("ui")));
        std::string path = (std::string)ui;
        fn = QString::fromUtf8(path.c_str());

        QFile file(fn);
        QWidget* form = 0;
        if (file.open(QFile::ReadOnly))
            form = loader.load(&file, 0);
        file.close();
        if (form) {
            Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(
                QPixmap(icon), form->windowTitle(), true, 0);
            taskbox->groupLayout()->addWidget(form);
            Content.push_back(taskbox);
        }
        else {
            Base::Console().Error("Failed to load UI file from '%s'\n",
                (const char*)fn.toUtf8());
        }
    }
    else if (dlg.hasAttr(std::string("form"))) {
        Py::Object f(dlg.getAttr(std::string("form"))); 
        Py::List widgets;
        if (f.isList()) {
            widgets = f;
        }
        else {
            widgets.append(f);
        }
        for (Py::List::iterator it = widgets.begin(); it != widgets.end(); ++it) {
            Py::Module mainmod(PyImport_AddModule((char*)"sip"));
            Py::Callable func = mainmod.getDict().getItem("unwrapinstance");
            Py::Tuple arguments(1);
            arguments[0] = *it; //PyQt pointer
            Py::Object result = func.apply(arguments);
            void* ptr = PyLong_AsVoidPtr(result.ptr());
            QObject* object = reinterpret_cast<QObject*>(ptr);
            if (object) {
                QWidget* form = qobject_cast<QWidget*>(object);
                if (form) {
                    Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(
                        form->windowIcon().pixmap(32), form->windowTitle(), true, 0);
                    taskbox->groupLayout()->addWidget(form);
                    Content.push_back(taskbox);
                }
            }
        }
    }
}
Example #3
0
TaskDialogPython::TaskDialogPython(const Py::Object& o) : dlg(o)
{
    if (dlg.hasAttr(std::string("ui"))) {
        UiLoader loader;
#if QT_VERSION >= 0x040500
        loader.setLanguageChangeEnabled(true);
#endif
        QString fn, icon;
        Py::String ui(dlg.getAttr(std::string("ui")));
        std::string path = (std::string)ui;
        fn = QString::fromUtf8(path.c_str());

        QFile file(fn);
        QWidget* form = 0;
        if (file.open(QFile::ReadOnly))
            form = loader.load(&file, 0);
        file.close();
        if (form) {
            Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(
                QPixmap(icon), form->windowTitle(), true, 0);
            taskbox->groupLayout()->addWidget(form);
            Content.push_back(taskbox);
        }
        else {
            Base::Console().Error("Failed to load UI file from '%s'\n",
                (const char*)fn.toUtf8());
        }
    }
    else if (dlg.hasAttr(std::string("form"))) {
        Py::Object f(dlg.getAttr(std::string("form"))); 
        Py::List widgets;
        if (f.isList()) {
            widgets = f;
        }
        else {
            widgets.append(f);
        }

        Gui::PythonWrapper wrap;
        if (wrap.loadCoreModule()) {
            for (Py::List::iterator it = widgets.begin(); it != widgets.end(); ++it) {
                QObject* object = wrap.toQObject(*it);
                if (object) {
                    QWidget* form = qobject_cast<QWidget*>(object);
                    if (form) {
                        Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(
                            form->windowIcon().pixmap(32), form->windowTitle(), true, 0);
                        taskbox->groupLayout()->addWidget(form);
                        Content.push_back(taskbox);
                    }
                }
            }
        }
    }
}
Example #4
0
void MainWindow::currentChanged(int index)
{
    PropertyWidget::getInstance()->clear();
    QWidget *widget = ui->tabWidget->widget(index);
    ui->treeWidget->takeTopLevelItem(0);
    if(widget && widget->windowTitle().contains(".xml") && widget->windowTitle().contains("ui/")){
        UIEditWidget *uiedit = (UIEditWidget *)widget;
        QTreeWidgetItem *topLevelItem = (QTreeWidgetItem *)uiedit->getTopView();
        ui->treeWidget->addTopLevelItem(topLevelItem);
    }
}
void MainWindow::showCategorieWidget(SidebarChildCategorie *categorie)
{
    QWidget *w = categorie->widget();

    if(w) {
        if(!w->windowTitle().isEmpty()) {
            setWindowTitle(w->windowTitle()+ QString::fromUtf8(" \u2013 ")+m_title );
        }
        if(!categorie->icon().isNull()) {
            setWindowIcon(categorie->icon());
        }
        setCentralWidget(w);
    }
}
Example #6
0
AccountseditorConfigDialog::AccountseditorConfigDialog( ViewBase *view, AccountTreeView *treeview, QWidget *p)
    : KPageDialog(p),
      m_view( view ),
      m_treeview( treeview )
{
    setCaption( i18n("Settings") );
    setButtons( Ok|Cancel );
    setDefaultButton( Ok );
    showButtonSeparator( true );

    QTabWidget *tab = new QTabWidget();

    QWidget *w = ViewBase::createPageLayoutWidget( view );
    tab->addTab( w, w->windowTitle() );
    m_pagelayout = w->findChild<KoPageLayoutWidget*>();
    Q_ASSERT( m_pagelayout );

    m_headerfooter = ViewBase::createHeaderFooterWidget( view );
    m_headerfooter->setOptions( view->printingOptions() );
    tab->addTab( m_headerfooter, m_headerfooter->windowTitle() );

    KPageWidgetItem *page = addPage( tab, i18n( "Printing" ) );
    page->setHeader( i18n( "Printing Options" ) );

    connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()));
}
Example #7
0
  const char *getCharProperty(GWEN_DIALOG_PROPERTY prop,
                              int index,
                              const char *defaultValue) {
    QWidget *qw;
    QString str;

    qw=(QWidget*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL);
    assert(qw);

    switch(prop) {
    case GWEN_DialogProperty_Title:
      str=qw->windowTitle();
      if (str.isEmpty())
        return defaultValue;
      else {
        GWEN_Widget_SetText(_widget, QT4_DIALOG_STRING_TITLE, str.toUtf8());
        return GWEN_Widget_GetText(_widget, QT4_DIALOG_STRING_TITLE);
      }
      break;

    default:
      break;
    }

    DBG_WARN(GWEN_LOGDOMAIN,
             "Function is not appropriate for this type of widget (%s)",
             GWEN_Widget_Type_toString(GWEN_Widget_GetType(_widget)));
    return defaultValue;
  };
void WindowMenu::onAboutToShow()
{
   QWidget* win = QApplication::activeWindow();
   pMinimize_->setEnabled(win);
   pZoom_->setEnabled(win && win->maximumSize() != win->minimumSize());
   pBringAllToFront_->setEnabled(win);


   for (int i = windows_.size() - 1; i >= 0; i--)
   {
      QAction* pAction = windows_[i];
      removeAction(pAction);
      windows_.removeAt(i);
      pAction->deleteLater();
   }

   QWidgetList topLevels = QApplication::topLevelWidgets();
   for (int i = 0; i < topLevels.size(); i++)
   {
      QWidget* pWindow = topLevels.at(i);
      if (!pWindow->isVisible())
         continue;

      QAction* pAction = new QAction(pWindow->windowTitle(), pWindow);
      pAction->setData(QVariant::fromValue(pWindow));
      pAction->setCheckable(true);
      if (pWindow->isActiveWindow())
         pAction->setChecked(true);
      insertAction(pWindowPlaceholder_, pAction);
      connect(pAction, SIGNAL(triggered()),
              this, SLOT(showWindow()));

      windows_.append(pAction);
   }
}
//----
ResourceAppointmentsSettingsDialog::ResourceAppointmentsSettingsDialog( ViewBase *view, ResourceAppointmentsItemModel *model, QWidget *parent )
    : KPageDialog( parent ),
    m_view( view )
{
    ResourceAppointmentsDisplayOptionsPanel *panel = new ResourceAppointmentsDisplayOptionsPanel( model );
    KPageWidgetItem *page = addPage( panel, i18n( "General" ) );
    page->setHeader( i18n( "Resource Assignments View Settings" ) );

    QTabWidget *tab = new QTabWidget();

    QWidget *w = ViewBase::createPageLayoutWidget( view );
    tab->addTab( w, w->windowTitle() );
    m_pagelayout = w->findChild<KoPageLayoutWidget*>();
    Q_ASSERT( m_pagelayout );

    m_headerfooter = ViewBase::createHeaderFooterWidget( view );
    m_headerfooter->setOptions( view->printingOptions() );
    tab->addTab( m_headerfooter, m_headerfooter->windowTitle() );

    page = addPage( tab, i18n( "Printing" ) );
    page->setHeader( i18n( "Printing Options" ) );

    connect( this, SIGNAL(accepted()), this, SLOT(slotOk()));
    connect( this, SIGNAL(accepted()), panel, SLOT(slotOk()));
    //TODO: there was no default button configured, should there?
//     connect( button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked(bool)), panel, SLOT(setDefault()));
}
Example #10
0
void IdealController::addView(Qt::DockWidgetArea area, View* view)
{
    IdealDockWidget *dock = new IdealDockWidget(this, m_mainWindow);
    // dock object name is used to store toolview settings
    QString dockObjectName = view->document()->title();
    // support different configuration for same docks opened in different areas
    if (m_mainWindow->area())
        dockObjectName += '_' + m_mainWindow->area()->objectName();

    dock->setObjectName(dockObjectName);

    KAcceleratorManager::setNoAccel(dock);
    QWidget *w = view->widget(dock);
    if (w->parent() == 0)
    {
        /* Could happen when we're moving the widget from
           one IdealDockWidget to another.  See moveView below.
           In this case, we need to reparent the widget. */
        w->setParent(dock);
    }

    QList<QAction *> toolBarActions = view->toolBarActions();
    if (toolBarActions.isEmpty()) {
      dock->setWidget(w);
    } else {
      QMainWindow *toolView = new QMainWindow();
      QToolBar *toolBar = new QToolBar(toolView);
      int iconSize = m_mainWindow->style()->pixelMetric(QStyle::PM_SmallIconSize);
      toolBar->setIconSize(QSize(iconSize, iconSize));
      toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
      toolBar->setWindowTitle(i18n("%1 Tool Bar", w->windowTitle()));
      toolBar->setFloatable(false);
      toolBar->setMovable(false);
      toolBar->addActions(toolBarActions);
      toolView->setCentralWidget(w);
      toolView->addToolBar(toolBar);
      dock->setWidget(toolView);
    }

    dock->setWindowTitle(view->widget()->windowTitle());
    dock->setWindowIcon(view->widget()->windowIcon());
    dock->setFocusProxy(dock->widget());

    if (IdealButtonBarWidget* bar = barForDockArea(area)) {
        QAction* action = bar->addWidget(
            view->document()->title(), dock,
            static_cast<MainWindow*>(parent())->area(), view);
        m_dockwidget_to_action[dock] = m_view_to_action[view] = action;

        m_docks->addAction(action);
        connect(dock, &IdealDockWidget::closeRequested, action, &QAction::toggle);
    }

    connect(dock, &IdealDockWidget::dockLocationChanged, this, &IdealController::dockLocationChanged);

    dock->hide();

    docks.insert(dock);
}
Example #11
0
bool MainWin::eventFilter(QObject *target, QEvent *e) {
	QSettings settings;
	if(e->type() == QEvent::Close) {
		QWidget *w = (QWidget *)target;
		settings.setValue(w->windowTitle() + "/geometry", w->saveGeometry());
	}
	return QMainWindow::eventFilter(target, e);
}
TaskSketcherValidation::TaskSketcherValidation(Sketcher::SketchObject* Obj)
{
    QWidget* widget = new SketcherValidation(Obj);
    Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(
        QPixmap(), widget->windowTitle(), true, 0);
    taskbox->groupLayout()->addWidget(widget);
    Content.push_back(taskbox);
}
void ConsoleWidgetCollection::onConsoleWindowTitleChanged(const QString & title)
{
	QWidget* widget = dynamic_cast<QWidget*>(sender());
	QDockWidget* dockWidget = dynamic_cast<QDockWidget*>(sender()->parent());
	if (!widget || !dockWidget)
		return;
	dockWidget->setWindowTitle(widget->windowTitle());
}
/*! \reimp */
QString Q3AccessibleTitleBar::text(Text t, int child) const
{
    QString str = QAccessibleWidget::text(t, child);
    if (str.size())
        return str;

    QWidget *window = titleBar()->window();
    switch (t) {
    case Name:
        switch (child) {
        case 1:
            return Q3TitleBar::tr("System");
        case 3:
            if (window && window->isMinimized())
                return Q3TitleBar::tr("Restore up");
            return Q3TitleBar::tr("Minimize");
        case 4:
            if (window && window->isMaximized())
                return Q3TitleBar::tr("Restore down");
            return Q3TitleBar::tr("Maximize");
        case 5:
            return Q3TitleBar::tr("Close");
        default:
            break;
        }
        break;
    case Value:
        if (!child || child == 2)
            return window ? window->windowTitle() : QString();
        break;
/*
    case DefaultAction:
        if (child > 2)
            return Q3TitleBar::tr("Press");
        break;
*/
    case Description:
        switch (child) {
        case 1:
            return Q3TitleBar::tr("Contains commands to manipulate the window");
        case 3:
            if (window && window->isMinimized())
                return Q3TitleBar::tr("Puts a minimized window back to normal");
            return Q3TitleBar::tr("Moves the window out of the way");
        case 4:
            if (window && window->isMaximized())
                return Q3TitleBar::tr("Puts a maximized window back to normal");
            return Q3TitleBar::tr("Makes the window full screen");
        case 5:
            return Q3TitleBar::tr("Closes the window");
        default:
            return Q3TitleBar::tr("Displays the name of the window and contains controls to manipulate it");
        }
    default:
        break;
    }
    return str;
}
void QDockTabWidget::onCurrenChanged(int)
{
    QWidget* cur = currentWidget();
    if (!cur)
    {
        return;
    }
    emit setBasePanelTitle(cur->windowTitle());
}
Example #16
0
void ToolBoxManager::retranslate() const
{
    int ct = _toolBox->count();
    for (int i=0; i<ct; i++) {
        // get always the first item widget
        QWidget* w = _toolBox->widget(i);
        QByteArray toolbarName = w->objectName().toUtf8();
        w->setWindowTitle(QObject::trUtf8(toolbarName.constData()));
        _toolBox->setItemText(i, w->windowTitle());
    }
}
Example #17
0
void DlgSettings::show(const QString& title)
{
    const auto count = ui_.tab->count();
    for (int i=0; i<count; ++i)
    {
        QWidget* tab = ui_.tab->widget(i);
        if (tab->windowTitle() == title)
        {
            ui_.tab->setCurrentIndex(i);
            return;
        }
    }
}
void DlgCustomizeImp::changeEvent(QEvent *e)
{
    if (e->type() == QEvent::LanguageChange) {
        setWindowTitle(tr("Customize"));
        buttonHelp->setText(tr("&Help"));
        buttonClose->setText(tr("&Close"));
        int count = tabWidget->count();
        for (int i=0; i<count; i++) {
            QWidget* w = tabWidget->widget(i);
            tabWidget->setTabText(i, w->windowTitle());
        }
    }
    QDialog::changeEvent(e);
}
Example #19
0
/**
 * If to a new language is switched this method gets called.
 */
void ToolBox::changeEvent(QEvent *e)
{
  if (e->type() == QEvent::LanguageChange) {
    QWidget::changeEvent(e);
    int ct = count();
    for ( int i=0; i<ct; i++ ) {
      QWidget* w = widget( i );
      if ( w )
        setItemText( i, w->windowTitle() );
    }
  } else {
    QWidget::changeEvent(e);
  }
}
Example #20
0
DeployBuildMdiChild::DeployBuildMdiChild() {
  QGridLayout *grid = new QGridLayout();
  grid->setSizeConstraint( QLayout::SetDefaultConstraint );

  QWidget *wgt = getManagerWidget_FromWAPair(tr("project_manager"),
                                             tr("(PM)BF_DeployBuildForm"));

  grid->addWidget(wgt);
  grid->setContentsMargins(1,1,1,1);
  this->setContentsMargins(1,1,1,1);
  setLayout(grid);
  setWindowTitle(wgt->windowTitle());
  setWindowIcon(wgt->windowIcon());
  setMinimumSize(1000, 550);
}
void QToolBarAreaLayout::saveState(QDataStream &stream) const
{
    // save toolbar state
    stream << (uchar) ToolBarStateMarkerEx;

    int lineCount = 0;
    for (int i = 0; i < QInternal::DockCount; ++i)
        lineCount += docks[i].lines.count();

    stream << lineCount;

    for (int i = 0; i < QInternal::DockCount; ++i) {
        const QToolBarAreaLayoutInfo &dock = docks[i];

        for (int j = 0; j < dock.lines.count(); ++j) {
            const QToolBarAreaLayoutLine &line = dock.lines.at(j);

            stream << i << line.toolBarItems.count();

            for (int k = 0; k < line.toolBarItems.count(); ++k) {
                const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
                QWidget *widget = const_cast<QLayoutItem*>(item.widgetItem)->widget();
                QString objectName = widget->objectName();
                if (objectName.isEmpty()) {
                    qWarning("QMainWindow::saveState(): 'objectName' not set for QToolBar %p '%s'",
                                widget, widget->windowTitle().toLocal8Bit().constData());
                }
                stream << objectName;
                // we store information as:
                // 1st bit: 1 if shown
                // 2nd bit: 1 if orientation is vertical (default is horizontal)
                uchar shownOrientation = (uchar)!widget->isHidden();
                if (QToolBar * tb= qobject_cast<QToolBar*>(widget)) {
                    if (tb->orientation() == Qt::Vertical)
                        shownOrientation |= 2;
                }
                stream << shownOrientation;
                stream << item.pos;
                //we store the preferred size. If the use rdidn't resize the toolbars it will be -1
                stream << item.preferredSize;

                uint geom0, geom1;
                packRect(&geom0, &geom1, widget->geometry(), widget->isWindow());
                stream << geom0 << geom1;
            }
        }
    }
}
Example #22
0
bool GCF::Components::MainWindow::eventFilter(QObject* obj, QEvent* event)
{
    if(event->type() == QEvent::WindowTitleChange)
    {
        QWidget* w = qobject_cast<QWidget*>(obj);
        int index = d->workspace->indexOf(w);
        if(index < 0)
            return false;

        QString title = w->windowTitle();

        d->workspace->setTabText(index, title);
    }

    return false;
}
Example #23
0
        Titlebar( QWidget *parent ) : parent( parent )
        {
            QLabel *label = new QLabel( parent->windowTitle() );
            QPushButton *buttonMinimise = new QPushButton(QIcon(":/images/minimize.png"),
                                                          tr(""), this);
            QPushButton *buttonMaximise = new QPushButton(QIcon(":/images/maximizeSelected.png"),
                                                          tr(""), this);

            QHBoxLayout *layout = new QHBoxLayout( this );
                layout->addWidget( label, 1 );
                layout->addWidget( buttonMinimise );
                layout->addWidget( buttonMaximise );

            connect( buttonMinimise, SIGNAL( clicked() ), parent, SLOT( minimiseCodePanel() ) );
//            connect( buttonMaximise, SIGNAL( clicked() ), parent, SLOT( maximiseCodePanel() ) );
        }
void MousePluginWidget::configure()
{
    if (!m_pluginInstance) {
        Plasma::ContainmentActions *pluginInstance = Plasma::ContainmentActions::load(m_containment, m_plugin.pluginName());
        if (!pluginInstance) {
            //FIXME tell user
            kDebug() << "failed to load plugin!";
            return;
        }

        m_pluginInstance = pluginInstance;

        if (m_lastConfigLocation.isEmpty()) {
            pluginInstance->restore(m_tempConfig);
        } else {
            KConfigGroup cfg = m_containment->containmentActionsConfig();
            cfg = KConfigGroup(&cfg, m_lastConfigLocation);
            pluginInstance->restore(cfg);
        }
    }

    if (!m_configDlg) {
        m_configDlg = new QDialog(qobject_cast<QWidget*>(parent()));
        QLayout *lay = new QVBoxLayout(m_configDlg);
        m_configDlg->setLayout(lay);
        m_configDlg->setWindowModality(Qt::WindowModal);

        //put the config in the dialog
        QWidget *w = m_pluginInstance.data()->createConfigurationInterface(m_configDlg);
        if (w) {
            lay->addWidget(w);
        }
	const QString title = w->windowTitle();

        m_configDlg->setWindowTitle(title.isEmpty() ? i18n("Configure Plugin") :title);
        //put buttons below
        QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
                                                         Qt::Horizontal, m_configDlg);
        lay->addWidget(buttons);

        //TODO other signals?
        connect(buttons, SIGNAL(accepted()), this, SLOT(acceptConfig()));
        connect(buttons, SIGNAL(rejected()), this, SLOT(rejectConfig()));
    }

    m_configDlg->show();
}
Example #25
0
bool MyEventFilter::eventFilter(QObject* obj, QEvent* event)
{
	if (event->type() == QEvent::WindowTitleChange)
	{
		QWidget* window = qobject_cast<QWidget*>(obj);
		if (window)
			emit windowTitleChanged(window->windowTitle());
	}
	else if (event->type() == QEvent::ModifiedChange)
	{
		QWidget* window = qobject_cast<QWidget*>(obj);
		if (window)
			emit modifiedChanged(window->isWindowModified());
	}

	return QObject::eventFilter(obj, event);
}
Example #26
0
void MainWindow::on_action_savexml_triggered()
{
    QWidget *widget = ui->tabWidget->currentWidget();
    if(widget)
    {
        if(widget->windowTitle().contains(".xml"))
        {
            UIEditWidget *uiedit =  (UIEditWidget *)widget;
            uiedit->save();
            LOG("保存" + uiedit->windowTitle());
        }else{
            LuaEditWidget *luaedit =  (LuaEditWidget *)widget;
            luaedit->save();
            LOG("保存" + luaedit->windowTitle());
        }
    }
}
Example #27
0
bool 
Unicorn::TabBar::eventFilter( QObject* o, QEvent* e )
{
    if( e->type() != QEvent::Close )
        return false;
    
    QWidget* w;
    if( !( w = qobject_cast< QWidget* >( o )))
        return false;
        
    if( w->windowTitle().isEmpty())
        return false;
        
    ((TabWidget*)parentWidget())->addTab( w );
    w->removeEventFilter( this );
    return true;
}
Example #28
0
bool main_tab_widget::eventFilter(QObject* watched, QEvent* event)
{
    if (event->type() == QEvent::WindowTitleChange ||
        event->type() == QEvent::WindowIconChange ||
        event->type() == QEvent::ToolTipChange)
    {
        QWidget* w = qobject_cast<QWidget*>(watched);
        int i = indexOf(w);
        if (event->type() == QEvent::WindowTitleChange)
            setTabText(i, w->windowTitle());
        else if (event->type() == QEvent::WindowIconChange)
            setTabIcon(i, w->windowIcon());
        else if (event->type() == QEvent::ToolTipChange)
            setTabToolTip(i, w->toolTip());
    }

    return QTabWidget::eventFilter(watched, event);
}
Example #29
0
void uiforms::sTest()
{
  q.prepare("SELECT *"
            "  FROM uiform "
            " WHERE(uiform_id=:uiform_id);");
  q.bindValue(":uiform_id", _uiform->id());
  q.exec();
  if (q.first())
    ; // everything's OK
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  else
    return;
  
  XMainWindow * wnd = new XMainWindow();
  wnd->setObjectName(q.value("uiform_name").toString());

  XUiLoader loader;
  QByteArray ba = q.value("uiform_source").toString().toUtf8();
  qDebug("about to load a uiFile with %s", ba.constData());
  QBuffer uiFile(&ba);
  if(!uiFile.open(QIODevice::ReadOnly))
  {
    QMessageBox::critical(this, tr("Could not load file"),
        tr("There was an error loading the UI Form from the database."));
    return;
  }
  QWidget *ui = loader.load(&uiFile);
  if (ui)
  {
    wnd->setWindowTitle(ui->windowTitle());
    wnd->setCentralWidget(ui);
    omfgThis->handleNewWindow(wnd);
  }
  else
    QMessageBox::critical(this, tr("Could not load file"),
                          tr("<p>Could not interpret the UI Form data "
                             "as a UI definition."));
  uiFile.close();
}
Example #30
0
void GwtCallback::reloadZoomWindow()
{
   QWidgetList topLevels = QApplication::topLevelWidgets();
   for (int i = 0; i < topLevels.size(); i++)
   {
      QWidget* pWindow = topLevels.at(i);
      if (!pWindow->isVisible())
         continue;

      if (pWindow->windowTitle() == QString::fromAscii("Plot Zoom"))
      {
         // do the reload
         BrowserWindow* pBrowserWindow = (BrowserWindow*)pWindow;
         pBrowserWindow->webView()->reload();

         break;
      }
   }
}