本文整理汇总了C++中QWidget::inherits方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::inherits方法的具体用法?C++ QWidget::inherits怎么用?C++ QWidget::inherits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWidget
的用法示例。
在下文中一共展示了QWidget::inherits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeTabPage
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();
}
}
}
示例2: showRMBMenu
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 );
}
}
}
示例3: editableWidgetBlurred
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();
}
示例4: refreshVolumeLevels
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();
}
}
示例5: doLayout
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 );
}
示例6: contextHelpActivated
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
}
示例7: if
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 );
}
示例8: setCellContentFromEditor
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() );
}
示例9: testSplitViewBuddies
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()));
}
示例10: if
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();
}
示例11: WidgetQ
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);
}
示例12: DateBookWeekLstHeaderBase
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;
}
示例13: e
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();
}
示例14: if
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);
}
示例15: openBookmark
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;
}