/*! \internal Wraps the Motif dialog by setting the X window for the QtMotifDialog to the X window id of the dialog shell. */ void QtMotifDialog::realize( Widget w ) { // use the winid of the dialog shell, reparent any children we have if ( XtWindow( w ) != winId() ) { XSync(QtMotif::display(), FALSE); XtSetMappedWhenManaged( d->shell, False ); // save the window title QString wtitle = windowTitle(); if (wtitle.isEmpty()) { char *t = 0; XtVaGetValues(w, XtNtitle, &t, NULL); wtitle = QString::fromLocal8Bit(t); } setWindowTitle(QString()); // make sure setWindowTitle() works below QString icontext = windowIconText(); if (icontext.isEmpty()) { char *iconName = 0; XtVaGetValues(w, XtNiconName, &iconName, NULL); icontext = QString::fromLocal8Bit(iconName); } setWindowIconText(QString()); // make sure setWindowTitle() works below Window newid = XtWindow(w); QObjectList list = children(); for (int i = 0; i < list.size(); ++i) { QWidget *widget = qobject_cast<QWidget*>(list.at(i)); if (!widget || widget->isWindow()) continue; XReparentWindow(widget->x11Info().display(), widget->winId(), newid, widget->x(), widget->y()); } QApplication::syncX(); create( newid, true, true ); // restore the window title and icon text if (!wtitle.isEmpty()) setWindowTitle(wtitle); if (!icontext.isEmpty()) setWindowIconText(icontext); // if this dialog was created without a QWidget parent, then the transient // for will be set to the root window, which is not acceptable. // instead, set it to the window id of the shell's parent if ( ! parent() && XtParent( d->shell ) ) XSetTransientForHint(x11Info().display(), newid, XtWindow(XtParent(d->shell))); } QtMotif::registerWidget( this ); }
MainWin::MainWin(QWidget *parent) #ifdef HAVE_KDE : KMainWindow(parent), _kHelpMenu(new KHelpMenu(this, KGlobal::mainComponent().aboutData())), #else : QMainWindow(parent), #endif coreLagLabel(new QLabel()), sslLabel(new QLabel()), msgProcessorStatusWidget(new MsgProcessorStatusWidget()), _titleSetter(this), _awayLog(0) { #ifdef Q_WS_WIN dwTickCount = 0; #endif QtUiSettings uiSettings; QString style = uiSettings.value("Style", QString()).toString(); if(!style.isEmpty()) { QApplication::setStyle(style); } QApplication::setQuitOnLastWindowClosed(false); setWindowTitle("Quassel IRC"); setWindowIconText("Quassel IRC"); updateIcon(); installEventFilter(new JumpKeyHandler(this)); }
MainWin::MainWin(QWidget *parent) #ifdef HAVE_KDE : KMainWindow(parent), _kHelpMenu(new KHelpMenu(this, KGlobal::mainComponent().aboutData())), #else : QMainWindow(parent), #endif _msgProcessorStatusWidget(new MsgProcessorStatusWidget(this)), _coreConnectionStatusWidget(new CoreConnectionStatusWidget(Client::coreConnection(), this)), _titleSetter(this), _awayLog(0), _layoutLoaded(false) { setAttribute(Qt::WA_DeleteOnClose, false); // we delete the mainwin manually QtUiSettings uiSettings; QString style = uiSettings.value("Style", QString()).toString(); if(!style.isEmpty()) { QApplication::setStyle(style); } QApplication::setQuitOnLastWindowClosed(false); setWindowTitle("Quassel IRC"); setWindowIconText("Quassel IRC"); updateIcon(); }
SerialMonitor::SerialMonitor(QWidget *parent) : QWidget(parent) { ui.setupUi(this); setWindowIconText("serial"); ui.plainTextEdit->setReadOnly(true); ui.btnAutoScroll->setVisible(false); // disable autoscroll not yet implemented connect (ui.btnReOpen, SIGNAL(clicked()), this, SLOT(ReOpenPort())); connect (ui.btnSend, SIGNAL(clicked()), this, SLOT(SendData())); connect (ui.lineEdit, SIGNAL(returnPressed()), this, SLOT(SendData())); //connect (&serialPort, SIGNAL(readyRead()), this, SLOT(ReadSerialPort())); LoadStyleSheet(this, "style_serial_monitor.css"); portId = ""; int index = ui.cbSpeed->findText("9600"); ui.cbSpeed->setCurrentIndex(index); //ui.cbSpeed->setCurrentText("9600"); portSpeed = "9600"; }
void NormalWindow::updateWindow(const QIcon &AIcon, const QString &ACaption, const QString &ATitle, const QString &AToolTip) { setWindowIcon(AIcon); setWindowIconText(ACaption); setWindowTitle(ATitle); FTabPageToolTip = AToolTip; emit tabPageChanged(); }
int QWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 23) qt_static_metacall(this, _c, _id, _a); _id -= 23; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isModal(); break; case 1: *reinterpret_cast< Qt::WindowModality*>(_v) = windowModality(); break; case 2: *reinterpret_cast< bool*>(_v) = isEnabled(); break; case 3: *reinterpret_cast< QRect*>(_v) = geometry(); break; case 4: *reinterpret_cast< QRect*>(_v) = frameGeometry(); break; case 5: *reinterpret_cast< QRect*>(_v) = normalGeometry(); break; case 6: *reinterpret_cast< int*>(_v) = x(); break; case 7: *reinterpret_cast< int*>(_v) = y(); break; case 8: *reinterpret_cast< QPoint*>(_v) = pos(); break; case 9: *reinterpret_cast< QSize*>(_v) = frameSize(); break; case 10: *reinterpret_cast< QSize*>(_v) = size(); break; case 11: *reinterpret_cast< int*>(_v) = width(); break; case 12: *reinterpret_cast< int*>(_v) = height(); break; case 13: *reinterpret_cast< QRect*>(_v) = rect(); break; case 14: *reinterpret_cast< QRect*>(_v) = childrenRect(); break; case 15: *reinterpret_cast< QRegion*>(_v) = childrenRegion(); break; case 16: *reinterpret_cast< QSizePolicy*>(_v) = sizePolicy(); break; case 17: *reinterpret_cast< QSize*>(_v) = minimumSize(); break; case 18: *reinterpret_cast< QSize*>(_v) = maximumSize(); break; case 19: *reinterpret_cast< int*>(_v) = minimumWidth(); break; case 20: *reinterpret_cast< int*>(_v) = minimumHeight(); break; case 21: *reinterpret_cast< int*>(_v) = maximumWidth(); break; case 22: *reinterpret_cast< int*>(_v) = maximumHeight(); break; case 23: *reinterpret_cast< QSize*>(_v) = sizeIncrement(); break; case 24: *reinterpret_cast< QSize*>(_v) = baseSize(); break; case 25: *reinterpret_cast< QPalette*>(_v) = palette(); break; case 26: *reinterpret_cast< QFont*>(_v) = font(); break; case 27: *reinterpret_cast< QCursor*>(_v) = cursor(); break; case 28: *reinterpret_cast< bool*>(_v) = hasMouseTracking(); break; case 29: *reinterpret_cast< bool*>(_v) = isActiveWindow(); break; case 30: *reinterpret_cast< Qt::FocusPolicy*>(_v) = focusPolicy(); break; case 31: *reinterpret_cast< bool*>(_v) = hasFocus(); break; case 32: *reinterpret_cast< Qt::ContextMenuPolicy*>(_v) = contextMenuPolicy(); break; case 33: *reinterpret_cast< bool*>(_v) = updatesEnabled(); break; case 34: *reinterpret_cast< bool*>(_v) = isVisible(); break; case 35: *reinterpret_cast< bool*>(_v) = isMinimized(); break; case 36: *reinterpret_cast< bool*>(_v) = isMaximized(); break; case 37: *reinterpret_cast< bool*>(_v) = isFullScreen(); break; case 38: *reinterpret_cast< QSize*>(_v) = sizeHint(); break; case 39: *reinterpret_cast< QSize*>(_v) = minimumSizeHint(); break; case 40: *reinterpret_cast< bool*>(_v) = acceptDrops(); break; case 41: *reinterpret_cast< QString*>(_v) = windowTitle(); break; case 42: *reinterpret_cast< QIcon*>(_v) = windowIcon(); break; case 43: *reinterpret_cast< QString*>(_v) = windowIconText(); break; case 44: *reinterpret_cast< double*>(_v) = windowOpacity(); break; case 45: *reinterpret_cast< bool*>(_v) = isWindowModified(); break; case 46: *reinterpret_cast< QString*>(_v) = toolTip(); break; case 47: *reinterpret_cast< QString*>(_v) = statusTip(); break; case 48: *reinterpret_cast< QString*>(_v) = whatsThis(); break; case 49: *reinterpret_cast< QString*>(_v) = accessibleName(); break; case 50: *reinterpret_cast< QString*>(_v) = accessibleDescription(); break; case 51: *reinterpret_cast< Qt::LayoutDirection*>(_v) = layoutDirection(); break; case 52: *reinterpret_cast< bool*>(_v) = autoFillBackground(); break; case 53: *reinterpret_cast< QString*>(_v) = styleSheet(); break; case 54: *reinterpret_cast< QLocale*>(_v) = locale(); break; case 55: *reinterpret_cast< QString*>(_v) = windowFilePath(); break; case 56: *reinterpret_cast< Qt::InputMethodHints*>(_v) = inputMethodHints(); break; } _id -= 57; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 1: setWindowModality(*reinterpret_cast< Qt::WindowModality*>(_v)); break; case 2: setEnabled(*reinterpret_cast< bool*>(_v)); break; case 3: setGeometry(*reinterpret_cast< QRect*>(_v)); break; case 8: move(*reinterpret_cast< QPoint*>(_v)); break; case 10: resize(*reinterpret_cast< QSize*>(_v)); break; case 16: setSizePolicy(*reinterpret_cast< QSizePolicy*>(_v)); break; case 17: setMinimumSize(*reinterpret_cast< QSize*>(_v)); break; case 18: setMaximumSize(*reinterpret_cast< QSize*>(_v)); break; case 19: setMinimumWidth(*reinterpret_cast< int*>(_v)); break; case 20: setMinimumHeight(*reinterpret_cast< int*>(_v)); break; case 21: setMaximumWidth(*reinterpret_cast< int*>(_v)); break; case 22: setMaximumHeight(*reinterpret_cast< int*>(_v)); break; case 23: setSizeIncrement(*reinterpret_cast< QSize*>(_v)); break; case 24: setBaseSize(*reinterpret_cast< QSize*>(_v)); break; case 25: setPalette(*reinterpret_cast< QPalette*>(_v)); break; case 26: setFont(*reinterpret_cast< QFont*>(_v)); break; case 27: setCursor(*reinterpret_cast< QCursor*>(_v)); break; case 28: setMouseTracking(*reinterpret_cast< bool*>(_v)); break; case 30: setFocusPolicy(*reinterpret_cast< Qt::FocusPolicy*>(_v)); break; case 32: setContextMenuPolicy(*reinterpret_cast< Qt::ContextMenuPolicy*>(_v)); break; case 33: setUpdatesEnabled(*reinterpret_cast< bool*>(_v)); break; case 34: setVisible(*reinterpret_cast< bool*>(_v)); break; case 40: setAcceptDrops(*reinterpret_cast< bool*>(_v)); break; case 41: setWindowTitle(*reinterpret_cast< QString*>(_v)); break; case 42: setWindowIcon(*reinterpret_cast< QIcon*>(_v)); break; case 43: setWindowIconText(*reinterpret_cast< QString*>(_v)); break; case 44: setWindowOpacity(*reinterpret_cast< double*>(_v)); break; case 45: setWindowModified(*reinterpret_cast< bool*>(_v)); break; case 46: setToolTip(*reinterpret_cast< QString*>(_v)); break; case 47: setStatusTip(*reinterpret_cast< QString*>(_v)); break; case 48: setWhatsThis(*reinterpret_cast< QString*>(_v)); break; case 49: setAccessibleName(*reinterpret_cast< QString*>(_v)); break; case 50: setAccessibleDescription(*reinterpret_cast< QString*>(_v)); break; case 51: setLayoutDirection(*reinterpret_cast< Qt::LayoutDirection*>(_v)); break; case 52: setAutoFillBackground(*reinterpret_cast< bool*>(_v)); break; case 53: setStyleSheet(*reinterpret_cast< QString*>(_v)); break; case 54: setLocale(*reinterpret_cast< QLocale*>(_v)); break; case 55: setWindowFilePath(*reinterpret_cast< QString*>(_v)); break; case 56: setInputMethodHints(*reinterpret_cast< Qt::InputMethodHints*>(_v)); break; } _id -= 57; } else if (_c == QMetaObject::ResetProperty) { switch (_id) { case 27: unsetCursor(); break; case 51: unsetLayoutDirection(); break; case 54: unsetLocale(); break; } _id -= 57; } else if (_c == QMetaObject::QueryPropertyDesignable) { bool *_b = reinterpret_cast<bool*>(_a[0]); switch (_id) { case 41: *_b = isWindow(); break; case 42: *_b = isWindow(); break; case 43: *_b = isWindow(); break; case 44: *_b = isWindow(); break; case 45: *_b = isWindow(); break; case 55: *_b = isWindow(); break; } _id -= 57; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 57; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 57; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 57; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 57; } #endif // QT_NO_PROPERTIES return _id; }
Editor::Editor(QWidget *parent) : QsciScintilla(parent) { // identify this widget as a code editor // WindoweIconText is used only for windows widgets. // So, it's free for us to use it here setWindowIconText("editor"); //setEolMode(QsciScintilla::EolUnix); lexer = new QsciLexerCPP; this->setLexer(lexer); this->setUtf8(true); //setAutoCompletionThreshold(0); api = new QsciAPIs(lexer); api->prepare(); LoadStyleSheet(this, "style_code_editor.css"); setAutoCompletionThreshold(3); setAutoCompletionSource(QsciScintilla::AcsAll); context= new QMenu(this); LoadStyleSheet(context, "style_menu.css"); actionHelpWithThis = context->addAction("Help with this code"); connect(actionHelpWithThis, SIGNAL(triggered()), this, SLOT(HelpWithThis())); context->addSeparator(); QAction * action = context->addAction("Undo"); action->setShortcut(tr("Ctrl+Z")); connect(action, SIGNAL(triggered()), this, SLOT(MenuUndo())); action = context->addAction("Redo"); action->setShortcut(tr("Ctrl+Y")); connect(action, SIGNAL(triggered()), this, SLOT(MenuRedo())); context->addSeparator(); action = context->addAction("Cut"); action->setShortcut(tr("Ctrl+X")); connect(action, SIGNAL(triggered()), this, SLOT(MenuCut())); action = context->addAction("Copy"); action->setShortcut(tr("Ctrl+C")); connect(action, SIGNAL(triggered()), this, SLOT(MenuCopy())); action = context->addAction("Paste"); action->setShortcut(tr("Ctrl+V")); connect(action, SIGNAL(triggered()), this, SLOT(MenuPaste())); /*action = context->addAction("Delete"); connect(action, SIGNAL(triggered()), this, SLOT(MenuDelete())); */ context->addSeparator(); action = context->addAction("Select all"); action->setShortcut(tr("Ctrl+A")); connect(action, SIGNAL(triggered()), this, SLOT(MenuSelectAll())); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this,SLOT(ShowEditorMenu(const QPoint ))); connect(this, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(onCursorPositionChanged(int, int))); lblCursorPosition = new QLabel(this); LoadStyleSheet(lblCursorPosition, "style_cursorpos.css"); lblCursorPosition->setVisible(true); QVBoxLayout * vl = new QVBoxLayout(this); //QVBoxLayout * vl2 = new QVBoxLayout(this); int scrollbarw = qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent); QHBoxLayout * hl = new QHBoxLayout(this); hl->addSpacerItem(new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Fixed)); hl->addWidget(lblCursorPosition); hl->addSpacerItem(new QSpacerItem (scrollbarw,0, QSizePolicy::Fixed, QSizePolicy::Fixed)); vl->addLayout(hl); vl->addSpacerItem(new QSpacerItem(0,0, QSizePolicy::Fixed,QSizePolicy::Expanding )); lastModifiedTime = QDateTime::currentDateTime(); setAutoIndent(true); setEditorStyle(); }
screen::screen(QWidget *_parent) : QWidget (0) { bInputted = false; setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint); // setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint); bHide = false; setFocusPolicy(Qt::StrongFocus); for (int i = 0; i < 256; i++){ switch(i % 16){ case 0: colors[i] = Qt::black; break; case 1: colors[i] = Qt::darkBlue; break; case 2: colors[i] = Qt::darkGreen; break; case 3: colors[i] = Qt::darkCyan; break; case 4: colors[i] = Qt::darkRed; break; case 5: colors[i] = Qt::darkMagenta; break; case 6: colors[i] = QColor(153, 102, 0); break; case 7: colors[i] = Qt::lightGray; break; case 8: colors[i] = Qt::darkGray; break; case 9: colors[i] = Qt::blue; break; case 10: colors[i] = Qt::green; break; case 11: colors[i] = Qt::cyan; break; case 12: colors[i] = Qt::red; break; case 13: colors[i] = Qt::magenta; break; case 14: colors[i] = Qt::yellow; break; case 15: colors[i] = Qt::white; break; } if (i / 16 > 0){ colors[i] = colors[i].dark(100 + 50 * i / 16); } } nForecolor = 15; nBackcolor = 0; nInput2 = nInput = 0xffff; // no key pressed setWindowTitle("Screen"); setWindowIconText("Screen"); m2 = QPixmap(getWidth, getHeight); m2.fill(Qt::black); nForecolor = 15; nBackcolor = 0; bCursor = false; nCursorX = 1; nCursorY = 1; font = QFont("Courier"); font.setPixelSize(16); setHidden(true); setFixedSize(getWidth, getHeight); // WORKAROUND nTimerId = startTimer( 500 ); bCTRL = false; bSHIFT = false; bWasActivated = bActivated = false; setHidden(true); QRect r = QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen()); move((r.width() / 2) - (width() / 2), (r.height() / 2) - (height() / 2)); }
QBookEmu::QBookEmu(QWidget* parent) : QMainWindow(0, Qt::Window | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint) , m_ui(new Ui::QBookEmu()) { m_ui->setupUi(this); setWindowIconText("QBookApp"); QVBoxLayout* layout = new QVBoxLayout(m_ui->centralwidget); layout->setMargin(0); layout->setSpacing(0); m_ui->centralwidget->setLayout(layout); QBookApp::staticInit(); m_app = QBookApp::instance(); #ifndef Q_WS_QWS switch(QBook::getResolution()) { case QBook::RES600x800: qDebug() << "********** Setting screen size to 825 (800 + menubar)"; setFixedSize(600,825); m_ui->centralwidget->setFixedSize(600,800); break; case QBook::RES758x1024: qDebug() << "********* Setting screen size to 1049 (1024 + menubar)"; setFixedSize(758,1049); m_ui->centralwidget->setFixedSize(758,1024); break; default: qWarning() << Q_FUNC_INFO << "UNKNOWN SCREEN SIZE"; } #endif layout->addWidget(m_app); connect(m_ui->menubar, SIGNAL(triggered(QAction*)), this, SLOT(handleAction(QAction*))); QActionGroup* battery = new QActionGroup(this); battery->addAction(m_ui->actionBattery0); battery->addAction(m_ui->actionBattery1); battery->addAction(m_ui->actionBattery2); battery->addAction(m_ui->actionBattery3); battery->addAction(m_ui->actionBatteryWarning); battery->addAction(m_ui->actionBatteryFull); QActionGroup* antenna = new QActionGroup(this); antenna->addAction(m_ui->actionAntenna0); antenna->addAction(m_ui->actionAntenna1); antenna->addAction(m_ui->actionAntenna2); antenna->addAction(m_ui->actionAntenna3); antenna->addAction(m_ui->actionAntenna4); antenna->addAction(m_ui->actionAntennaDisable); m_ui->actionBattery3->trigger(); m_ui->actionMmc->setChecked(true); m_ui->actionCharger->setChecked(ADConverter::getInstance()->getStatus() != ADConverter::ADC_STATUS_NO_WIRE); }