Esempio n. 1
0
void HierarchyList::removeTabPage()
{
    QWidget *w = current();
    if ( !w )
  return;
    if ( w->inherits( "QTabWidget" ) ) {
  QTabWidget *tw = (QTabWidget*)w;
  if ( tw->currentPage() ) {
      QDesignerTabWidget *dtw = (QDesignerTabWidget*)tw;
      DeleteTabPageCommand *cmd = new DeleteTabPageCommand( i18n("Delete Page %1 of %2" ).
                  arg( dtw->pageTitle() ).arg( tw->name() ),
                  formWindow, tw, tw->currentPage() );
      formWindow->commandHistory()->addCommand( cmd );
      cmd->execute();
  }
    } else if ( w->inherits( "QWizard" ) ) {
  QWizard *wiz = (QWizard*)formWindow->mainContainer();
  if ( wiz->currentPage() ) {
      QDesignerWizard *dw = (QDesignerWizard*)wiz;
      DeleteWizardPageCommand *cmd = new DeleteWizardPageCommand( i18n("Delete Page %1 of %2" ).
                  arg( dw->pageTitle() ).arg( wiz->name() ),
                  formWindow, wiz,
                  wiz->indexOf( wiz->currentPage() ), true );
      formWindow->commandHistory()->addCommand( cmd );
      cmd->execute();
  }
    }
}
Esempio n. 2
0
void HierarchyList::showRMBMenu( QListViewItem *i, const QPoint & p )
{
    if ( !i )
  return;


    QWidget *w = findWidget( i );
    if ( !w )
  return;

    if ( w != formWindow &&
   !formWindow->widgets()->find( w ) )
  return;

    if ( w->isVisibleTo( formWindow ) ) {
  if ( !w->inherits( "QTabWidget" ) && !w->inherits( "QWizard" ) ) {
      if ( !normalMenu )
    normalMenu = formWindow->mainWindow()->setupNormalHierarchyMenu( this );
      normalMenu->popup( p );
  } else {
      if ( !tabWidgetMenu )
    tabWidgetMenu =
        formWindow->mainWindow()->setupTabWidgetHierarchyMenu( this, SLOT( addTabPage() ),
                        SLOT( removeTabPage() ) );
      tabWidgetMenu->popup( p );
  }
    }
}
Esempio n. 3
0
void KHTMLPartBrowserExtension::editableWidgetBlurred( QWidget * /*widget*/ )
{
    QWidget *oldWidget = m_editableFormWidget;

    m_editableFormWidget = 0;
    enableAction( "cut", false );
    enableAction( "paste", false );
    m_part->emitSelectionChanged();

    if ( m_connectedToClipboard )
    {
        disconnect( QApplication::clipboard(), SIGNAL(dataChanged()),
                    this, SLOT(updateEditActions()) );

        if ( oldWidget )
        {
            if ( oldWidget->inherits( "QLineEdit" ) || oldWidget->inherits( "QTextEdit" ) )
                disconnect( oldWidget, SIGNAL(selectionChanged()),
                            this, SLOT(updateEditActions()) );
        }

        m_connectedToClipboard = false;
    }
    editableWidgetBlurred();
}
void ViewSwitches::refreshVolumeLevels() {
    //kdDebug(67100) << "ViewSwitches::refreshVolumeLevels()\n";
     QWidget *mdw = _mdws.first();
     MixDevice* md;
     for ( md = _mixSet->first(); md != 0; md = _mixSet->next() ) {
	 if ( mdw == 0 ) {
	     kdError(67100) << "ViewSwitches::refreshVolumeLevels(): mdw == 0\n";
	     break; // sanity check (normally the lists are set up correctly)
	 }
	 else {
	     if ( mdw->inherits("MDWSwitch")) {
		 //kdDebug(67100) << "ViewSwitches::refreshVolumeLevels(): updating\n";
		 // a slider, fine. Lets update its value
		 static_cast<MDWSwitch*>(mdw)->update();
	     }
	     else if ( mdw->inherits("MDWEnum")) {
		static_cast<MDWEnum*>(mdw)->update();
             }
	     else {
		 kdError(67100) << "ViewSwitches::refreshVolumeLevels(): mdw is not slider\n";
		 // no switch. Cannot happen in theory => skip it
		 // If I start putting other stuff in the switch tab, I will get a nice warning.
	     }
	 }
	 mdw = _mdws.next();
    }
}
Esempio n. 5
0
void GridLayout::doLayout()
{
    bool needMove, needReparent;
    if ( !prepareLayout( needMove, needReparent ) )
	return;

    QDesignerGridLayout *layout = (QDesignerGridLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::Grid );

    if ( !grid )
	buildGrid();

    QWidget* w;
    int r, c, rs, cs;
    for ( w = widgets.first(); w; w = widgets.next() ) {
	if ( grid->locateWidget( w, r, c, rs, cs) ) {
	    if ( needReparent && w->parent() != layoutBase )
		w->reparent( layoutBase, 0, QPoint( 0, 0 ), FALSE );
	    if ( rs * cs == 1 ) {
		layout->addWidget( w, r, c, w->inherits( "Spacer" ) ? ( (Spacer*)w )->alignment() : 0 );
	    } else {
		layout->addMultiCellWidget( w, r, r+rs-1, c, c+cs-1, w->inherits( "Spacer" ) ? ( (Spacer*)w )->alignment() : 0 );
	    }
	    w->show();
	} else {
	    qWarning("ooops, widget '%s' does not fit in layout", w->name() );
	}
    }
    finishLayout( needMove, layout );
}
Esempio n. 6
0
void KHelpMenu::contextHelpActivated()
{
  QWhatsThis::enterWhatsThisMode();
  QWidget* w = QApplication::widgetAt( QCursor::pos(), true );
  while ( w && !w->isTopLevel() && !w->inherits("QXEmbed")  )
      w = w->parentWidget();
#ifdef Q_WS_X11
   if ( w && w->inherits("QXEmbed") )
	  (( QXEmbed*) w )->enterWhatsThisMode();
#endif
}
Esempio n. 7
0
void
Style::drawLineEdit(const QStyleOption *option, QPainter *painter, const QWidget *widget, bool round) const
{
    // spinboxes and combos allready have a lineedit as global frame
    // TODO: exclude Q3Combo??
    QWidget *daddy = widget ? widget->parentWidget() : 0L;
    if (qstyleoption_cast<const QStyleOptionFrame*>(option) && static_cast<const QStyleOptionFrame *>(option)->lineWidth < 1)
    {
        if (appType == KDM || (daddy && ( qobject_cast<QComboBox*>(daddy) || daddy->inherits("QAbstractSpinBox"))))
            return;
        painter->fillRect(RECT, FCOLOR(Base));
        return;
    }
    if (Hacks::config.invertDolphinUrlBar && daddy && daddy->inherits("KUrlNavigator"))
        return;

    OPT_ENABLED OPT_FOCUS

//       round = true;
    isEnabled = isEnabled && !(option->state & State_ReadOnly);
    QRect r = RECT;
    QRect RECT2 = QRect( 1, 0, r.width()-1, r.height() );

    if (isEnabled)
    {
        const Tile::Set &mask = masks.rect[round && appType != GTK];
        r.setBottom(r.bottom() - F(2));
        if (PAL.brush(QPalette::Base).style() > 1 ) // pixmap, gradient, whatever
            { QPixmap *buffer = bgBuffer(PAL, r); mask.render(r, painter, *buffer); delete buffer; }
        else if (r.height() > 2*option->fontMetrics.height()) // no lineEdit... like some input frames in QWebKit
        {
            const QColor &c = FCOLOR(Base);
            mask.render(r, painter, (hasFocus && Colors::value(c) < 100) ? c.lighter(112) : c);
        }
        else
            mask.render(r, painter, Gradients::Sunken, Qt::Vertical, FCOLOR(Base));
        if (hasFocus)
            lights.glow[round].render(RECT, painter, FCOLOR(Highlight));
    }
    if (appType == GTK)
        shadows.fallback.render(RECT,painter);
    else
        shadows.sunken[round][isEnabled].render(RECT2, painter);


    painter->setPen( QColor( 0, 0, 0, 100 ) ); // Black color
    painter->drawRoundedRect( 1, 1, r.width()-3, r.height()-2, 3, 3 );
    painter->setPen( QColor( 220, 220, 220, 255 ) ); // White color
    painter->drawRoundedRect( 0, 0, r.width()-1, r.height(), 3, 3 );
    

    
}
Esempio n. 8
0
void MTable::setCellContentFromEditor( int row, int col )
{
    QWidget *editor = cellWidget( row, col );
    if ( !editor ) return;
    clearCell( row, col );
    if ( editor->inherits( "QComboBox" ) ){
	  QString str = ((QComboBox*)editor )->currentText();
                //if ( str == "no medium" ) str = "";
	  setText( row, col, str );
    }
    else if ( editor->inherits( "QLineEdit" ) )
	   setText( row, col, ( (QLineEdit*)editor )->text() );
}
Esempio n. 9
0
void TestBuddies::testSplitViewBuddies()
{
    Sublime::MainWindow *pMainWindow = toSublimeWindow(m_uiController->activeMainWindow());

    enableBuddies();
    enableOpenAfterCurrent();

    QTemporaryDir tempDirA;
    QDir dirA(tempDirA.path());
    createFile(dirA, "classA.cpp");
    createFile(dirA, "classA.h");

    Sublime::Area *pCodeArea = m_uiController->activeArea();
    QVERIFY(pCodeArea);

    IDocument *pClassAHeader = m_documentController->openDocument(QUrl::fromLocalFile(dirA.filePath("classA.h")));
    QVERIFY(pClassAHeader);
    pMainWindow->activeView()->setObjectName("classA.h");

    // now, create a splitted view of the active view (pClassAHeader)
    Sublime::View *pNewView = pMainWindow->activeView()->document()->createView();
    pNewView->setObjectName("splitOf" + pMainWindow->activeView()->objectName());
    pCodeArea->addView(pNewView, pMainWindow->activeView(), Qt::Vertical);
    // and activate it
    pMainWindow->activateView(pNewView);

    // get the current view's container from the mainwindow
    QWidget *pCentral = pMainWindow->centralWidget();
    QVERIFY(pCentral);
    QVERIFY(pCentral->inherits("QWidget"));

    QWidget *pSplitter = pCentral->findChild<QSplitter*>();
    QVERIFY(pSplitter);
    QVERIFY(pSplitter->inherits("QSplitter"));

    Sublime::Container *pContainer = pSplitter->findChild<Sublime::Container*>();
    QVERIFY(pContainer);

    // check that it only contains pNewView
    QVERIFY(pContainer->count() == 1 && pContainer->hasWidget(pNewView->widget()));

    // now open the correponding definition file, classA.cpp
    IDocument *pClassAImplem = m_documentController->openDocument(QUrl::fromLocalFile(dirA.filePath("classA.cpp")));
    QVERIFY(pClassAImplem);
    pMainWindow->activeView()->setObjectName("classA.cpp");

    // and check its presence alongside pNewView in pContainer
    QVERIFY(pContainer->hasWidget(pNewView->widget()));
    QVERIFY(pContainer->hasWidget(pMainWindow->activeView()->widget()));
}
void	QsvTextOperationsWidget::showBottomWidget(QWidget* w)
{
	if (w == NULL) {
		if (m_replace && m_replace->isVisible())
			w = m_replace;
		else if (m_search && m_search->isVisible())
			w = m_search;
		else if (m_gotoLine && m_gotoLine->isVisible())
			w = m_gotoLine;
	}
	if (!w)
		return;

	QRect r;
	QWidget *parent = qobject_cast<QWidget*>(this->parent());

	// I must admit this line looks ugly, but I am open to suggestions
	if (parent->inherits("QAbstractScrollArea"))
		parent = ((QAbstractScrollArea*) (parent))->viewport();

	r = parent->rect();
	w->adjustSize();
	r.adjust(10, 0, -10, 0);
	r.setHeight(w->height());
	r.moveBottom(parent->rect().height()-10);

	r.moveLeft(parent->pos().x() + 10);
	w->setGeometry(r);
	w->show();
}
Esempio n. 11
0
logical OFrame :: DA_SaveClose ( )
{
  QWidget   *qwidget = WidgetQ();
  QWidget   *qparent = qwidget ? qwidget->parentWidget() : NULL;
  logical     term    = NO;
BEGINSEQ
  OEHDataWidget::DA_Save();
/// q3 there is no mainWidget
// if ( qwidget == qApp->mainWidget() )
//    term = Quit();
//  else
  {
    if ( !qparent )                                    ERROR

    if ( qparent->inherits("QDialog") )
      ((ODialog *)(QDialog *)qparent)->accept();
    else
      qparent->close();
  }

RECOVER
  term = YES;
ENDSEQ
  return(term);
}
Esempio n. 12
0
DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl)
    : DateBookWeekLstHeaderBase(parent, name, fl)
{
    setBackgroundMode( PaletteButton );
    labelDate->setBackgroundMode( PaletteButton );
    forwardweek->setBackgroundMode( PaletteButton );
    forwardweek->setPixmap( Opie::Core::OResource::loadPixmap( "forward", Opie::Core::OResource::SmallIcon ) );
    forwardmonth->setBackgroundMode( PaletteButton );
    forwardmonth->setPixmap( Opie::Core::OResource::loadPixmap( "fastforward", Opie::Core::OResource::SmallIcon ) );
    backweek->setBackgroundMode( PaletteButton );
    backweek->setPixmap( Opie::Core::OResource::loadPixmap( "back", Opie::Core::OResource::SmallIcon ) );
    backmonth->setBackgroundMode( PaletteButton );
    backmonth->setPixmap( Opie::Core::OResource::loadPixmap( "fastback", Opie::Core::OResource::SmallIcon ) );
    DateBookWeekLstHeaderBaseLayout->setSpacing(0);
    DateBookWeekLstHeaderBaseLayout->setMargin(0);
    //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));

    QWidget *tl = topLevelWidget();
    if (tl->inherits("QMainWindow")) {
        QMainWindow *mw = (QMainWindow*)tl;
        connect( mw, SIGNAL(pixmapSizeChanged(bool)), backmonth, SLOT(setUsesBigPixmap(bool)));
        connect( mw, SIGNAL(pixmapSizeChanged(bool)), backweek, SLOT(setUsesBigPixmap(bool)));
        connect( mw, SIGNAL(pixmapSizeChanged(bool)), forwardweek, SLOT(setUsesBigPixmap(bool)));
        connect( mw, SIGNAL(pixmapSizeChanged(bool)), forwardmonth, SLOT(setUsesBigPixmap(bool)));
    }
    
    connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth()));
    connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek()));
    connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek()));
    connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth()));
    connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate()));
    connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
    bStartOnMonday=onM;
}
Esempio n. 13
0
MsgFile::MsgFile(CToolCustom *parent, Message *msg)
        : QLineEdit(parent)
{
    m_client = msg->client();
    for (QWidget *p = parent->parentWidget(); p; p = p->parentWidget()){
        if (p->inherits("MsgEdit")){
            m_edit = static_cast<MsgEdit*>(p);
            break;
        }
    }
    m_edit->m_edit->setTextFormat(PlainText);
    QString t = msg->getPlainText();
    if (!t.isEmpty())
        m_edit->m_edit->setText(t);
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    parent->addWidget(this);
    QToolButton *btn = new QToolButton(parent);
    btn->setAutoRaise(true);
    btn->setIconSet(*Icon("fileopen"));
    btn->setTextLabel(i18n("Select file"));
    parent->addWidget(btn);
    btn->show();
    connect(btn, SIGNAL(clicked()), this, SLOT(selectFile()));
    parent->setText(i18n("File:"));
    connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(changed(const QString&)));
    Command cmd;
    cmd->id    = CmdSend;
    cmd->param = m_edit;
    Event e(EventCommandWidget, cmd);
    btnSend = (QToolButton*)(e.process());
    setText(static_cast<FileMessage*>(msg)->getFile());
    changed(text());
    show();
}
Esempio n. 14
0
void
MacMenu::manage(QMenuBar *menu)
{
    if (!menu) // ...
        return;
    
    // we only accept menus that are placed on a QMainWindow - for the moment, and probably ever
    QWidget *dad = menu->parentWidget();
    if (!(dad && dad->isWindow() && dad->inherits("QMainWindow") && dad->layout() && dad->layout()->menuBar() == menu))
        return;

//     if ((dad = dad->parentWidget()) && dad->inherits("QMdiSubWindow"))
//         return;
    

    if (!instance)
    {
        instance = new MacMenu;
        /*MacMenuAdaptor *adapt = */new MacMenuAdaptor(instance);
        fullscreenWatcher = new FullscreenWatcher;
    }
    else if (instance->items.contains(menu))
        return; // no double adds please!

    if (instance->usingMacMenu)
        instance->activate(menu);

    connect (menu, SIGNAL(destroyed(QObject *)), instance, SLOT(_release(QObject *)));

    instance->items.append(menu);
}
Esempio n. 15
0
void Menu::openBookmark()
{
	QWidget *menu = this;

	while (menu)
	{
		menu->close();
		menu = menu->parentWidget();

		if (!menu || !menu->inherits(QLatin1String("QMenu").data()))
		{
			break;
		}
	}

	MainWindow *mainWindow = MainWindow::findMainWindow(parent());
	QAction *action = qobject_cast<QAction*>(sender());

	if (action && action->data().type() == QVariant::ModelIndex)
	{
		m_bookmark = dynamic_cast<BookmarksItem*>(BookmarksManager::getModel()->itemFromIndex(action->data().toModelIndex()));
	}

	if (mainWindow)
	{
		const WindowsManager::OpenHints hints = (action ? static_cast<WindowsManager::OpenHints>(action->data().toInt()) : WindowsManager::DefaultOpen);

		mainWindow->getWindowsManager()->open(m_bookmark, ((hints == WindowsManager::DefaultOpen) ? WindowsManager::calculateOpenHints() : hints));
	}

	m_bookmark = NULL;
}
Esempio n. 16
0
void WeatherPlugin::showBar()
{
    if (m_bar || getID().isEmpty())
        return;
    QWidgetList  *list = QApplication::topLevelWidgets();
    QWidgetListIt it( *list );
    QWidget *w;
    QMainWindow *main = NULL;
    while ((w=it.current()) != 0) {
        ++it;
        if (w->inherits("MainWindow")) {
            main = static_cast<QMainWindow*>(w);
            break;
        }
    }
    delete list;
    if (main == NULL)
        return;
    EventToolbar e(BarWeather, main);
    e.process();
    m_bar = e.toolBar();
    restoreToolbar(m_bar, data.bar);
    connect(m_bar, SIGNAL(destroyed()), this, SLOT(barDestroyed()));
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
    QTimer::singleShot(0, this, SLOT(timeout()));
    timer->start(120000);
    updateButton();
}
Esempio n. 17
0
void Menu::mouseReleaseEvent(QMouseEvent *event)
{
	if (m_role == BookmarksMenuRole && (event->button() == Qt::LeftButton || event->button() == Qt::MiddleButton))
	{
		QAction *action = actionAt(event->pos());

		if (action && action->isEnabled() && action->data().type() == QVariant::ModelIndex)
		{
			QWidget *menu = this;

			while (menu)
			{
				menu->close();
				menu = menu->parentWidget();

				if (!menu || !menu->inherits(QLatin1String("QMenu").data()))
				{
					break;
				}
			}

			MainWindow *mainWindow = MainWindow::findMainWindow(parent());

			if (mainWindow)
			{
				mainWindow->getWindowsManager()->open(dynamic_cast<BookmarksItem*>(BookmarksManager::getModel()->itemFromIndex(action->data().toModelIndex())), WindowsManager::calculateOpenHints(event->modifiers(), event->button()));

				return;
			}
		}
	}

	QMenu::mouseReleaseEvent(event);
}
Esempio n. 18
0
void ShiptoEdit::sNew()
{
  if (canOpen())
  {
    if (!_x_privileges->check(_newPriv))
      return;

    ParameterList params;
    params.append("mode", "new");
    params.append("cust_id", _custid);

    QWidget* w = 0;
    if (parentWidget()->window())
    {
      if (parentWidget()->window()->isModal())
        w = _guiClientInterface->openWindow(_uiName, params, parentWidget()->window() , Qt::WindowModal, Qt::Dialog);
      else
        w = _guiClientInterface->openWindow(_uiName, params, parentWidget()->window() , Qt::NonModal, Qt::Window);
    }

    if (w->inherits("QDialog"))
    {
      QDialog* newdlg = qobject_cast<QDialog*>(w);
      int id = newdlg->exec();
      if (id != QDialog::Rejected)
      {
        silentSetId(id);
        emit newId(_id);
        emit valid(_id != -1);
      }
    }
  }
}
Esempio n. 19
0
void WeatherPlugin::showBar()
{
    if (m_bar || (*getID() == 0))
        return;
    QWidgetList  *list = QApplication::topLevelWidgets();
    QWidgetListIt it( *list );
    QWidget *w;
    while ((w=it.current()) != 0) {
        ++it;
        if (w->inherits("MainWindow"))
            break;
    }
    delete list;
    if (w == NULL)
        return;
    BarShow b;
    b.bar_id = BarWeather;
    b.parent = (QMainWindow*)w;
    Event e(EventShowBar, &b);
    m_bar = (QToolBar*)e.process();
    restoreToolbar(m_bar, data.bar);
    connect(m_bar, SIGNAL(destroyed()), this, SLOT(barDestroyed()));
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
    QTimer::singleShot(0, this, SLOT(timeout()));
    timer->start(120000);
    updateButton();
}
Esempio n. 20
0
EXPORT void restoreToolbar(QToolBar *bar, Data state[7])
{
    if (bar == NULL)
        return;
    if (state[0].value != SAVE_STATE){
        if (state[1].value == 0)
            state[1].value = (unsigned)(QMainWindow::Top);
        state[2].value = 0;
        state[3].value = 0;
        state[4].value = SAVE_STATE;
        state[5].value = 0;
        state[6].value = 0;
    }
    QMainWindow *main = NULL;
    for (QWidget *w = bar->parentWidget(); w; w = w->parentWidget()){
        if (w->inherits("QMainWindow")){
            main = static_cast<QMainWindow*>(w);
            break;
        }
    }
    if (main == NULL)
        return;
    QMainWindow::ToolBarDock dock = (QMainWindow::ToolBarDock)state[1].value;
    main->moveToolBar(bar, dock, state[2].value != 0, state[3].value != 0, state[4].value);
    if (dock == QMainWindow::TornOff)
        bar->move(state[5].value, state[6].value);
}
Esempio n. 21
0
void ViewApplet::resizeEvent(QResizeEvent *qre)
{
    //kdDebug(67100) << "ViewApplet::resizeEvent() size=" << qre->size() << "\n";
    // decide whether we have to show or hide all icons
    bool showIcons = shouldShowIcons(qre->size());

    for ( QWidget *mdw = _mdws.first(); mdw != 0; mdw = _mdws.next() ) {
	if ( mdw == 0 ) {
	    kdError(67100) << "ViewApplet::resizeEvent(): mdw == 0\n";
	    break; // sanity check (normally the lists are set up correctly)
	}
	else {
	    if ( mdw->inherits("MDWSlider")) {
		static_cast<MDWSlider*>(mdw)->setIcons(showIcons);
		static_cast<MDWSlider*>(mdw)->setValueStyle(MixDeviceWidget::NNONE);
		//static_cast<MDWSlider*>(mdw)->resize(qre->size());
	    }
	}
    }
    //    kdDebug(67100) << "ViewApplet::resizeEvent(). SHOULD resize _layoutMDW to " << qre->size() << endl;
    //QWidget::resizeEvent(qre);

    // resizing changes our own sizeHint(), because we must take the new PanelSize in account.
    // So updateGeometry() is amust for us.
    updateGeometry();
}
Esempio n. 22
0
/******************************************************************************
* Set a buddy widget.
* If it (or its focus proxy) is a radio button, create a focus widget.
* When the accelerator key is pressed, the focus widget then receives focus.
* That event triggers the selection of the radio button.
*/
void Label::setBuddy(QWidget *bud)
{
    if(mRadioButton)
        disconnect(mRadioButton, SIGNAL(destroyed()), this, SLOT(buddyDead()));
    QWidget *w = bud;
    if(w)
    {
        while(w->focusProxy())
            w = w->focusProxy();
        if(!w->inherits("QRadioButton"))
            w = 0;
    }
    if(!w)
    {
        // The buddy widget isn't a radio button
        QLabel::setBuddy(bud);
        delete mFocusWidget;
        mFocusWidget = 0;
        mRadioButton = 0;
    }
    else
    {
        // The buddy widget is a radio button, so set a different buddy
        if(!mFocusWidget)
            mFocusWidget = new LabelFocusWidget(this);
        QLabel::setBuddy(mFocusWidget);
        mRadioButton = (QRadioButton *)bud;
        connect(mRadioButton, SIGNAL(destroyed()), this, SLOT(buddyDead()));
    }
}
Esempio n. 23
0
bool DlgCustomActionsImp::event(QEvent* e)
{
    bool ok = QWidget::event(e);

    if (e->type() == QEvent::ParentChange || e->type() == QEvent::ParentAboutToChange)
    {
        QWidget* topLevel = this->parentWidget();
        while (topLevel && !topLevel->inherits("QDialog"))
            topLevel = topLevel->parentWidget();
        if ( topLevel )
        {
            int index = topLevel->metaObject()->indexOfSignal( QMetaObject::normalizedSignature("addMacroAction(const QByteArray&)") );
            if ( index >= 0 ) {
                if ( e->type() == QEvent::ParentChange ) {
                    connect(this, SIGNAL(addMacroAction( const QByteArray& )), 
                            topLevel, SIGNAL(addMacroAction( const QByteArray& )));
                    connect(this, SIGNAL(removeMacroAction( const QByteArray& )), 
                            topLevel, SIGNAL(removeMacroAction( const QByteArray& )));
                    connect(this, SIGNAL(modifyMacroAction( const QByteArray& )), 
                            topLevel, SIGNAL(modifyMacroAction( const QByteArray& )));
                } else {
                    disconnect(this, SIGNAL(addMacroAction( const QByteArray& )), 
                               topLevel, SIGNAL(addMacroAction( const QByteArray& )));
                    disconnect(this, SIGNAL(removeMacroAction( const QByteArray& )), 
                               topLevel, SIGNAL(removeMacroAction( const QByteArray& )));
                    disconnect(this, SIGNAL(modifyMacroAction( const QByteArray& )), 
                               topLevel, SIGNAL(modifyMacroAction( const QByteArray& )));
                }
            }
Esempio n. 24
0
// -----------------------------------------------------------------------
// Is called when the select toolbar button is pressed.
void QucsApp::slotSelect(bool on)
{
  QWidget *w = DocumentTab->currentPage();
  if(w->inherits("QTextEdit")) {
    ((TextDoc*)w)->viewport()->setFocus();

    select->blockSignals(true);
    select->setOn(true);
    select->blockSignals(false);
    return;
  }

  // goto to insertWire mode if ESC pressed during wiring
  Schematic *Doc = (Schematic*)DocumentTab->currentPage();
  if(MouseMoveAction == &MouseActions::MMoveWire2) {
    MouseMoveAction = &MouseActions::MMoveWire1;
    MousePressAction = &MouseActions::MPressWire1;
    Doc->viewport()->update();
    view->drawn = false;

    select->blockSignals(true);
    select->setOn(false);
    select->blockSignals(false);
    return;
  }

  if(performToggleAction(on, select, 0, 0, &MouseActions::MPressSelect)) {
    MouseReleaseAction = &MouseActions::MReleaseSelect;
    MouseDoubleClickAction = &MouseActions::MDoubleClickSelect;
  }
}
Esempio n. 25
0
void
PlayPauseAction::engineStateChanged( Engine::State state,  Engine::State /*oldState*/ )
{
    QString text;

    switch( state ) {
    case Engine::Playing:
        setChecked( false );
        setIcon( Amarok::icon( "pause" ) );
        text = i18n( "Pause" );
        break;
    case Engine::Paused:
        setChecked( true );
        setIcon( Amarok::icon( "pause" ) );
        text = i18n( "Pause" );
        break;
    case Engine::Empty:
        setChecked( false );
        setIcon( Amarok::icon( "play" ) );
        text = i18n( "Play" );
        break;
    case Engine::Idle:
        return;
    }

    //update menu texts for this special action
    for( int x = 0; x < containerCount(); ++x ) {
        QWidget *w = container( x );
        if( w->inherits( "QPopupMenu" ) )
            static_cast<QPopupMenu*>(w)->changeItem( itemId( x ), text );
        //TODO KToolBar sucks so much
//         else if( w->inherits( "KToolBar" ) )
//             static_cast<KToolBar*>(w)->getButton( itemId( x ) )->setText( text );
    }
}
static void write(QTextStream &ts, const RenderObject &o, int indent = 0)
{
    writeIndent(ts, indent);
    
    ts << o << "\n";
    
    if (o.isText() && !o.isBR()) {
        const RenderText &text = static_cast<const RenderText &>(o);
        for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
            writeIndent(ts, indent+1);
            writeTextRun(ts, text, *box);
        }
    }

    for (RenderObject *child = o.firstChild(); child; child = child->nextSibling()) {
        if (child->layer()) {
            continue;
        }
        write(ts, *child, indent + 1);
    }
    
    if (o.isWidget()) {
        QWidget *widget = static_cast<const RenderWidget &>(o).widget();
        if (widget && widget->inherits("KHTMLView")) {
            KHTMLView *view = static_cast<KHTMLView *>(widget);
            RenderObject *root = KWQ(view->part())->renderer();
            if (root) {
                view->layout();
                RenderLayer* l = root->layer();
                if (l)
                    writeLayers(ts, l, l, QRect(l->xPos(), l->yPos(), l->width(), l->height()), indent+1);
            }
        }
    }
}
Esempio n. 27
0
EXPORT void saveToolbar(QToolBar *bar, Data state[8])
{
    memset(state, 0, sizeof(state));
    if (bar == NULL)
        return;
    QMainWindow *main = NULL;
    for (QWidget *w = bar->parentWidget(); w; w = w->parentWidget()){
        if (w->inherits("QMainWindow")){
            main = static_cast<QMainWindow*>(w);
            break;
        }
    }
    if (main == NULL)
        return;
    QMainWindow::ToolBarDock dock;
    int  index;
    bool nl;
    int  extraOffset;
    main->getLocation(bar, dock, index, nl, extraOffset);
    state[0].value = 1;
    state[1].value = (long)dock;
    state[2].value = index;
    state[3].value = nl ? 1 : 0;
    state[4].value = extraOffset;
    if (dock == QMainWindow::TornOff){
        QPoint pos = bar->geometry().topLeft();
        state[5].value = pos.x();
        state[6].value = pos.y();
    }
}
Esempio n. 28
0
int main()
{
//! [1]
    Counter a, b;
//! [1] //! [2]
    QObject::connect(&a, SIGNAL(valueChanged(int)),
                     &b, SLOT(setValue(int)));
//! [2]

//! [3]
    a.setValue(12);     // a.value() == 12, b.value() == 12
//! [3] //! [4]
    b.setValue(48);     // a.value() == 12, b.value() == 48
//! [4]


    QWidget *widget = reinterpret_cast<QWidget *>(new QObject(0));
//! [5]
    if (widget->inherits("QAbstractButton")) {
        QAbstractButton *button = static_cast<QAbstractButton *>(widget);
        button->toggle();
//! [5] //! [6]
    }
//! [6]

//! [7]
    if (QAbstractButton *button = qobject_cast<QAbstractButton *>(widget))
        button->toggle();
//! [7]
}
void QwtPlotItem::updateLegend(QwtLegend *legend) const
{
    if ( !legend )
        return;

    QWidget *lgdItem = legend->find(this);
    if ( testItemAttribute(QwtPlotItem::Legend) )
    {
        if ( lgdItem == NULL )
        {
            lgdItem = legendItem();
            if ( lgdItem )
            {
                if ( lgdItem->inherits("QwtLegendItem") )
                {
                    QwtLegendItem *label = (QwtLegendItem *)lgdItem;
                    label->setItemMode(legend->itemMode());

                    if ( d_data->plot )
                    {
                        QObject::connect(label, SIGNAL(clicked()), 
                            d_data->plot, SLOT(legendItemClicked()));
                        QObject::connect(label, SIGNAL(checked(bool)), 
                            d_data->plot, SLOT(legendItemChecked(bool)));
                    }
                }
                legend->insert(this, lgdItem);
            }
Esempio n. 30
0
//
// changing a spinbox in klipper's config-dialog causes the lineedit-contents
// of the spinbox to be selected and hence the clipboard changes. But we don't
// want all those items in klipper's history. See #41917
//
bool Klipper::ignoreClipboardChanges() const
{
    QWidget *focusWidget = qApp->focusWidget();
    if ( focusWidget )
    {
        if ( focusWidget->inherits( "QSpinBox" ) ||
             (focusWidget->parentWidget() &&
              focusWidget->inherits("QLineEdit") &&
              focusWidget->parentWidget()->inherits("QSpinWidget")) )
        {
            return true;
        }
    }

    return false;
}