Example #1
0
Main::Main()
    : QMainWindow()
{
    QWidget *main = new QWidget (this);
    setCentralWidget(main);
    QVBoxLayout *layout = new QVBoxLayout;
    QListView *all = new QListView;
    all->setModelColumn(UPnPDeviceModel::DeviceRoleFriendlyName);
    all->setModel(UPnPDeviceModel::getDefault());
    QListView *server = new QListView;
    server->setModel(new UPnPServerModel ());
    server->setModelColumn(UPnPDeviceModel::DeviceRoleFriendlyName);
    connect (server, SIGNAL(activated(QModelIndex)), SLOT(onRowActivated(QModelIndex)));
    QListView *renderer = new QListView;
    renderer->setModel(new UPnPRendererModel ());
    renderer->setModelColumn(UPnPDeviceModel::DeviceRoleFriendlyName);
    m_browser = new QListView;

    layout->addWidget(new QLabel(QString::fromLatin1("All devices"), main));
    layout->addWidget(all);
    layout->addWidget(new QLabel(QString::fromLatin1("UPnP servers"), main));
    layout->addWidget(server);
    layout->addWidget(new QLabel(QString::fromLatin1("UPnP renderer"), main));
    layout->addWidget(renderer);
    layout->addWidget(new QLabel(QLatin1String("Browse test"), main));
    layout->addWidget(m_browser);
    main->setLayout(layout);
}
Example #2
0
PaletteBox::PaletteBox(QWidget* parent)
   : QDockWidget(tr("Palettes"), parent)
      {
      setObjectName("palette-box");
      setAllowedAreas(Qt::DockWidgetAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea));

      PaletteBoxScrollArea* sa = new PaletteBoxScrollArea;
      sa->setFocusPolicy(Qt::NoFocus);
      sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
      sa->setContextMenuPolicy(Qt::CustomContextMenu);
      sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      sa->setWidgetResizable(true);
      sa->setFrameShape(QFrame::NoFrame);
      setWidget(sa);

      QWidget* paletteList = new QWidget;
      sa->setWidget(paletteList);
      vbox = new QVBoxLayout;
      paletteList->setLayout(vbox);
      vbox->setMargin(0);
      vbox->setSpacing(1);
      vbox->addStretch();
      paletteList->show();
      }
CaptureFilePropertiesDialog::CaptureFilePropertiesDialog(QWidget &parent, CaptureFile &capture_file) :
    WiresharkDialog(parent, capture_file),
    ui(new Ui::CaptureFilePropertiesDialog)
{
    ui->setupUi(this);

    // XXX Use recent settings instead
    resize(parent.width() * 2 / 3, parent.height());

    QPushButton *button = ui->buttonBox->button(QDialogButtonBox::Reset);
    if (button) {
        button->setText(tr("Refresh"));
    }

    button = ui->buttonBox->button(QDialogButtonBox::Apply);
    if (button) {
        button->setText(tr("Copy To Clipboard"));
    }

    button = ui->buttonBox->button(QDialogButtonBox::Save);
    if (button) {
        button->setText(tr("Save Comments"));
    }

    setWindowSubtitle(tr("Capture File Properties"));
    updateWidgets();
}
Example #4
0
MainWindow::MainWindow()
{
    setWindowIcon(QIcon(":/images/seafile.png"));
    setWindowTitle(SEAFILE_CLIENT_BRAND);

    // Qt::Tool hides the taskbar entry on windows
    // setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint);

    setWindowFlags(Qt::Window
                   | Qt::FramelessWindowHint
                   | Qt::WindowSystemMenuHint
                   | Qt::WindowMinimizeButtonHint);

    cloud_view_ = new CloudView;

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(cloud_view_);

    QWidget *widget = new QWidget;
    widget->setObjectName("mainWrapper");
    widget->setLayout(layout);

    setCentralWidget(widget);

    createActions();
    setAttribute(Qt::WA_TranslucentBackground, true);
}
Example #5
0
QWidget *WidgetWithLayout::hBox(QWidget *parent)
{
    QHBoxLayout *layout = new QHBoxLayout(parent);
    QWidget *widget = new QWidget(parent);
    widget->setLayout(layout);
    return widget;
}
QWidget *ContactItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    Q_UNUSED(option);

    /* This is necessary because QTreeView (at least) clips the delegate to the editor area during editing,
     * and we need to render the entire thing. The container widget covers the entire area (which will be
     * the clip), and the actual editor is within that. */
    QWidget *container = new QWidget(parent);
    QLineEdit *widget = new QLineEdit(container);
    container->setFocusProxy(widget);

    QFont nickFont = widget->font();
    nickFont.setPixelSize(12);
    widget->setFont(nickFont);
    widget->setFrame(false);
    widget->setTextMargins(0, 0, 0, 0);
    widget->setContentsMargins(0, 0, 0, 0);

    ContactUser *user = index.data(ContactsModel::PointerRole).value<ContactUser*>();
    Q_ASSERT(user);

    NicknameValidator *validator = new NicknameValidator(widget);
    validator->setValidateUnique(user->identity, user);
    validator->setWidget(widget);
    widget->setValidator(validator);

    connect(widget, SIGNAL(editingFinished()), SLOT(editingFinished()));

    return container;
}
Example #7
0
bool DockPlugin::isMainShow()
{
    QWidget *main = getMainWindow();
    if (main && main->isVisible())
        return true;
    return false;
}
Example #8
0
void Window::InvalidateAll()
{
    QWidget *w = PWindow(wid);

    if (w)
        w->update();
}
Example #9
0
void Window::InvalidateRectangle(PRectangle rc)
{
    QWidget *w = PWindow(wid);

    if (w)
        w->update(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
}
Example #10
0
void FilePathPropertyEditor::onInitialize()
{
   QWidget* frame = new QWidget( this );
   QHBoxLayout* layout = new QHBoxLayout( frame );
   layout->setSpacing( 0 );
   layout->setMargin( 0 );
   frame->setLayout( layout );
   addWidget( frame );

   // a field that shows the resource
   m_droppedFilePath = new DropArea( frame, new FSNodeMimeData( m_paths ) );
   connect( m_droppedFilePath, SIGNAL( changed() ), this, SLOT( valChanged() ) );
   m_droppedFilePath->setMinimumSize( 20, 20 );
   m_droppedFilePath->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
   layout->addWidget( m_droppedFilePath );

   // a button for NULLing the resource
   QToolButton* eraseButton = new QToolButton( frame );
   eraseButton->setIcon( QIcon( ":/TamyEditor/Resources/Icons/Editor/quit.png" ) );
   eraseButton->setToolTip( "Reset value" );
   connect( eraseButton, SIGNAL( clicked( bool ) ), this, SLOT( valErased( bool ) ) );
   eraseButton->setMinimumSize( 20, 20 );
   eraseButton->setMaximumSize( 20, 20 );
   eraseButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
   layout->addWidget( eraseButton );

   refreshPropertyName();
}
Example #11
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QFileSystemModel model;
    QWidget window;
    QTreeView *tree = new QTreeView(&window);
    tree->setMaximumSize(1000, 600);

    QHBoxLayout *layout = new QHBoxLayout;
    layout->setSizeConstraint(QLayout::SetFixedSize);
    layout->addWidget(tree);

    window.setLayout(layout);
    model.setRootPath("");
    tree->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
    tree->setModel(&model);

    tree->setAnimated(false);
    tree->setIndentation(20);
    tree->setSortingEnabled(true);
    tree->header()->setStretchLastSection(false);

    window.setWindowTitle(QObject::tr("Dir View"));
    tree->header()->setSectionResizeMode(QHeaderView::ResizeToContents);

    window.show();

    return app.exec();
}
Example #12
0
int main(int argc, char *argv[])
{
    QCoreApplication::setApplicationName("QLua Test");

    QApplication::setApplicationVersion("1.0");
    QApplication::setApplicationName("QtLua Test App");

    QApplication a(argc, argv);    

    QLuaScriptEngine * engine = new QLuaScriptEngine(&a);

    //QLuaScriptEngineDebugger * debugger = new QLuaScriptEngineDebugger(engine);

    //debugger->attachTo(engine);

    QWidget w;
    w.setWindowTitle("Test window");
    w.show();

    engine->setGlobal("app", engine->newQObject(&a));
    engine->setGlobal("window", engine->newQObject(&w));

    engine->executeFile("deploy/test.lua");

    return a.exec();
}
int main(int argc, char **argv)
{
    BrowserApplication application(argc, argv);
    QCoreApplication::setApplicationName(QLatin1String("urllineeditexample"));
    QMainWindow w;

    QWidget *window = new QWidget;
    QComboBox *comboBox = new QComboBox(window);
    comboBox->setEditable(true);
    QLineEdit *lineEdit = new QLineEdit(window);
    LocationBar *s1 = new LocationBar(window);
    LocationBar *s2 = new LocationBar(window);
    WebView *view = new WebView(window);
    view->setUrl(QUrl("http://www.google.com"));
    s2->setWebView(view);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(comboBox);
    layout->addWidget(lineEdit);
    layout->addWidget(s1);
    layout->addWidget(s2);
    layout->addWidget(view);
    window->setLayout(layout);
    w.show();
    w.setCentralWidget(window);

    QToolBar *bar = w.addToolBar("foo");
    QSplitter *splitter = new QSplitter(window);
    splitter->addWidget(new LocationBar);
    splitter->addWidget(new QLineEdit);
    bar->addWidget(splitter);
    return application.exec();
}
Example #14
0
void TestQTestComplex::pl_widget_show_hide()
{
    QWidget *wid = new QWidget();
    wid->hide();
    wid->show();
    delete wid;
}
Example #15
0
int main(int argc, char *argv[])
{

    QApplication a(argc, argv);

    DrawingArea *area = new DrawingArea();

    QPushButton *triangualteBut = new QPushButton();
    triangualteBut->setText("Triangulate");

    QVBoxLayout *lay = new QVBoxLayout();
    lay->addWidget(area);
    //lay->addWidget(triangualteBut);

    QWidget window;
    window.setLayout(lay);
    window.show();

    Triangulator *t = new Triangulator(area);

    QObject::connect(triangualteBut,SIGNAL(clicked()),t,SLOT(triangulate()));
    t->triangulate();

    return a.exec();
}
Example #16
0
// Borrowed&modified from KBookmarkMenu...
BookmarkEditDialog::BookmarkEditDialog(const QString& title, const QString& url,
                                       QWidget * parent, const char * name, const QString& caption )
  : KDialogBase(parent, name, true, caption,
                (Ok|Cancel),
                Ok, false, KGuiItem()),
    m_title(0), m_location(0)
{
    setButtonOK( i18n( "&Update" ) );

    QWidget *main = new QWidget( this );
    setMainWidget( main );

    bool folder = url.isNull();
    QGridLayout *grid = new QGridLayout( main, 2, folder?1:2, spacingHint() );

    QLabel *nameLabel = new QLabel(i18n("Name:"), main, "title label");
    grid->addWidget(nameLabel, 0, 0);
    m_title = new KLineEdit(main, "title edit");
    m_title->setText(title);
    nameLabel->setBuddy(m_title);
    grid->addWidget(m_title, 0, 1);
    if(!folder) {
        QLabel *locationLabel = new QLabel(i18n("Location:"), main, "location label");
        grid->addWidget(locationLabel, 1, 0);
        m_location = new KLineEdit(main, "location edit");
        m_location->setText(url);
        locationLabel->setBuddy(m_location);
        grid->addWidget(m_location, 1, 1);
    }
    main->setMinimumSize( 300, 0 );
}
// size hint according to content
QSize QgsIdentifyResultsWebView::sizeHint() const
{
  QSize s = page()->mainFrame()->contentsSize();
  QgsDebugMsg( QString( "content size: %1 x %2" ).arg( s.width() ).arg( s.height() ) );
  int height = s.height();

  // if page is not yet loaded set some minimum height
  if ( height == 0 )
  {
    height = 100;
  }
  else
  {
    // parent is qt_scrollarea_viewport
    // parent is not available the first time - before results dialog was shown
    QWidget *widget = qobject_cast<QWidget *>( parent() );
    if ( widget )
    {
      int max = widget->size().height() * 0.9;
      QgsDebugMsg( QString( "parent widget height = %1 max height = %2" ).arg( widget->size().height() ).arg( max ) );
      if ( height > max )
        height = max;
    }
    else
    {
      QgsDebugMsg( "parent not available" ) ;
    }
  }

  s = QSize( size().width(), height );
  QgsDebugMsg( QString( "size: %1 x %2" ).arg( s.width() ).arg( s.height() ) );
  return s;
}
Window::Window()
    : m_icon(":/images/justlock.png"), m_logFiles(),  m_logStreams(), m_fileWatcher(0),
      m_maxRows(5), m_rowCount(0), m_warningIcon(":/images/trianglewarning.png")
{
    loadPreferences(true);
    createLogWidgets();
    createActions();
    createTrayIcon();
    createMenus();
    QWidget *widget = new QWidget();
    widget->setLayout(m_topLayout);
    setCentralWidget(widget);

    createRegexps();

    // setup the tray icon
    trayIcon->setToolTip(tr("Shows the status of DNSSEC Requests on the system"));
    trayIcon->setIcon(m_icon);
    setWindowIcon(m_icon);

    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));


    trayIcon->show();

    setWindowTitle(tr("DNSSEC Log Messages"));
}
Example #19
0
bool DockPlugin::eventFilter(QObject *o, QEvent *e)
{
    if (o == m_popup){
        if (e->type() == QEvent::Hide){
            m_popup->removeEventFilter(this);
            m_popup = NULL;
        }
    }else{
        switch (e->type()){
        case QEvent::Close:
            if (!m_bQuit){
                QWidget *main = static_cast<QWidget*>(o);
                setShowMain(false);
                main->hide();
                return true;
            }
            break;
        case QEvent::WindowDeactivate:
            time(&m_inactiveTime);
            break;
        case QEvent::WindowActivate:
            m_inactiveTime = 0;
            break;
        default:
            break;
        }
    }
    return QObject::eventFilter(o, e);
}
GraphViewerWidget::GraphViewerWidget(QWidget *parent)
  : QWidget(parent),
    mWidget(new GraphWidget(this))
{
  mModel = ObjectBroker::model("com.kdab.GammaRay.ObjectVisualizerModel");

  QSortFilterProxyModel *objectFilter = new KRecursiveFilterProxyModel(this);
  objectFilter->setSourceModel(mModel);
  objectFilter->setDynamicSortFilter(true);

  QVBoxLayout *vbox = new QVBoxLayout;
  KFilterProxySearchLine *objectSearchLine = new KFilterProxySearchLine(this);
  objectSearchLine->setProxy(objectFilter);
  vbox->addWidget(objectSearchLine);
  QTreeView *objectTreeView = new QTreeView(this);
  objectTreeView->setModel(objectFilter);
  objectTreeView->setSortingEnabled(true);
  vbox->addWidget(objectTreeView);

  mObjectTreeView = objectTreeView;

  QWidget *treeViewWidget = new QWidget(this);
  treeViewWidget->setLayout(vbox);

  QSplitter *splitter = new QSplitter(this);
  splitter->addWidget(treeViewWidget);
  splitter->addWidget(mWidget);
  QHBoxLayout *hbox = new QHBoxLayout(this);
  hbox->addWidget(splitter);

  QMetaObject::invokeMethod(this, "delayedInit", Qt::QueuedConnection);
}
Example #21
0
Q_DECL_EXPORT
#endif
int main(int argc, char *argv[])
{
#ifdef MEEGO_EDITION
	QScopedPointer<QApplication> app(MDeclarativeCache::qApplication(argc, argv));
#else
	QScopedPointer<QApplication> app(new QApplication(argc, argv));
#endif
	QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));
	QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf-8"));

#ifdef Q_WS_MAEMO_5
	QWidget *loadingWindow = new QWidget();
	loadingWindow->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
	loadingWindow->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, Qt::Checked);
	loadingWindow->show();
	app->processEvents();
#endif

	Core::ModuleManagerImpl core;
	Q_UNUSED(core);

	// At first time use current time with pointers to initiators
	qsrand(uint(std::time(0)) ^ qHash(qApp));
	// At second random value
	qsrand(uint(qrand()));
	// It looks like Qt doesn't always use srand as backend of qsrand
	srand(uint(qrand()));

#ifdef Q_WS_MAEMO_5
	loadingWindow->close();
#endif
	return app->exec();
}
Example #22
0
void Colors::postConfigure()
{
    if (!Colors::noAdapt){
        QWidget w;
        if (w.depth() < 16){
            Colors::useEightBitPalette = true;
            Colors::adapted = true;
            if (Colors::verbose)
                qDebug() << "- Adapt: Color depth less than 16 bit. Using 8 bit palette";
        }

        if (!Colors::xRenderPresent){
            Colors::setLowSettings();
            Colors::adapted = true;
            if (Colors::verbose)
                qDebug() << "- Adapt: X renderer not present. Using low settings";
        }
    }

    if (!Colors::openGlRendering && !Colors::softwareRendering){
        // The user has not decided rendering system. So we do it instead:
        if (Colors::openGlAvailable)
            Colors::openGlRendering = true;
        else
            Colors::softwareRendering = true;
    }
}
Example #23
0
/*!
    \class MainWindow mainwindow.h
    \brief Class fills graphical user interface with controls.
*/
MainWindow::MainWindow()
    : QWidget(0, Qt::FramelessWindowHint), m_embedded(false)
{
    // create a widget we can access in CSS: QWidget#PatientCare
    QWidget* top = new QWidget(this);

#if defined(Q_WS_HILDON) || defined(Q_WS_S60) || defined(Q_WS_QWS) || defined(Q_OS_WINCE)
    m_embedded = true;
#endif
    if (QApplication::arguments().contains("-embedded"))
        m_embedded = true;
    if (QApplication::arguments().contains("-no-embedded"))
        m_embedded = false;

    ui.setupUi(top);

    setWindowTitle("Pulse Oximeter");
    setWindowIcon(QIcon(":/qt-logo32x32"));

    m_controller = new PatientCareController(&ui, this);

    if (!m_embedded) {
        updateDecoration();
        top->setGeometry(153, 95, 636, 476);
    } else {
        QVBoxLayout *lay = new QVBoxLayout(this);
        lay->setContentsMargins(0, 0, 0, 0);
        lay->addWidget(top);

        qApp->setOverrideCursor(Qt::BlankCursor);
        setWindowState(Qt::WindowFullScreen);
    }
}
void KexiAnimatedLayout::Private::animateTo(QWidget* destination)
{
    QWidget *from = q->currentWidget();
    Q_ASSERT(destination && from);
    destinationWidget = destination;
    if (from == destinationWidget)
        return;
    if (!(KexiUtils::graphicEffectsLevel() & KexiUtils::SimpleAnimationEffects))
    {
        // animations not allowed: switch to destination widget immediately
        animationFinished();
        return;
    }
    bool toRight = q->currentIndex() < q->indexOf(destinationWidget);
    hide();
    setParent(from);
    QSize s(from->parentWidget()->size());
    QPoint startPos(toRight ? QPoint(0, 0) : QPoint(s.width(), 0));
    QPoint endPos(toRight ? QPoint(s.width(), 0) : QPoint(0, 0));
    animation.setStartValue(-startPos);
    animation.setEndValue(-endPos);
    buffer = QPixmap(s.width() * 2, s.height());
    buffer.fill(Qt::white);
    from->render(&buffer, startPos);
    //qDebug() << s << from->geometry() << destinationWidget->geometry();
    destinationWidget->resize(from->size()); // needed because destination could
                                               // have been never displayed
    destinationWidget->render(&buffer, endPos);
    resize(buffer.size());
    move(animation.startValue().toPoint().x(), animation.startValue().toPoint().y());
    show();
    animation.start();
}
Example #25
0
QWidget *WidgetWithLayout::gridBox(int nCols, QWidget *parent)
{
    QGridLayout *layout = new QGridLayout(parent);
    QWidget *widget = new QWidget(parent);
    widget->setLayout(layout);
    return widget;
}
Example #26
0
int main(int argc, char * argv[])
{
    QApplication a(argc, argv);

    QWidget window;

    QVBoxLayout * mainLayout = new QVBoxLayout(&window);
    QLabel * label = new QLabel("0");
    QSpinBox * spinBox = new QSpinBox;
    QSlider * slider = new QSlider(Qt::Horizontal);

    mainLayout->addWidget(label);
    mainLayout->addWidget(spinBox);
    mainLayout->addWidget(slider);

    QObject::connect(spinBox, SIGNAL(valueChanged(int)),
                     label, SLOT(setNum(int)));

    QObject::connect(spinBox, SIGNAL(valueChanged(int)),
                     slider, SLOT(setValue(int)));

    QObject::connect(slider, SIGNAL(valueChanged(int)),
                     label, SLOT(setNum(int)));
    QObject::connect(slider, SIGNAL(valueChanged(int)),
                     spinBox, SLOT(setValue(int)));

    window.show();
    a.exec();
}
Example #27
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    this->setWindowFlags( Qt::FramelessWindowHint );

    tasks = new Tasks();
    tasks->construct();

    trayIcon = new TrayIcon( this );

    QVBoxLayout *layout = new QVBoxLayout( this );
    layout->addWidget( tasks->getTasksWidget() );

    QWidget *wid = new QWidget( this );
//    wid->setContentsMargins( -10, -10, -10, -10 );
    this->setStyleSheet( /*"border: 4px solid red;"*/
                         "border-radius: 6px;");
    setCentralWidget( wid );
    wid->setLayout( layout );
    wid->setStyleSheet( baseColor );

    tasks->addTask( "test", 7 );
    tasks->addTask( "test", 7 );
    tasks->addTask( "test", 7 );
    tasks->removeTask( 2 );
    tasks->addTask( "test", 7 );

    connect( trayIcon, SIGNAL( quitPressed() ), this, SLOT( close() ) );

}
Example #28
0
void tst_QItemEditorFactory::createCustomEditor()
{
    QPointer<MyEditor> creator = new MyEditor;
    QPointer<MyEditor> creator2 = new MyEditor;

    {
        QItemEditorFactory editorFactory;

        editorFactory.registerEditor(QVariant::Rect, creator);
        editorFactory.registerEditor(QVariant::RectF, creator);

        //creator should not be deleted as a result of calling the next line
        editorFactory.registerEditor(QVariant::Rect, creator2);
        QVERIFY(creator);

        //this should erase creator2
        editorFactory.registerEditor(QVariant::Rect, creator);
        QVERIFY(creator2.isNull());


        QWidget parent;

        QWidget *w = editorFactory.createEditor(QVariant::Rect, &parent);
        QCOMPARE(w->metaObject()->className(), "QDoubleSpinBox");
        QCOMPARE(w->metaObject()->userProperty().type(), QVariant::Double);
    }

    //editorFactory has been deleted, so should be creator
    //because editorFActory has the ownership
    QVERIFY(creator.isNull());
    QVERIFY(creator2.isNull());

    delete creator;
}
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);
            }
Example #30
0
bool KApplication::notify(QObject *receiver, QEvent *event)
{
    QEvent::Type t = event->type();
    if( t == QEvent::Show && receiver->isWidgetType())
    {
        QWidget* w = static_cast< QWidget* >( receiver );
#if defined Q_WS_X11
        if( w->isTopLevel() && !startupId().isEmpty()) // TODO better done using window group leader?
            KStartupInfo::setWindowStartupId( w->winId(), startupId());
#endif
        if( w->isTopLevel() && !( w->windowFlags() & Qt::X11BypassWindowManagerHint ) && w->windowType() != Qt::Popup && !event->spontaneous())
        {
            if( d->app_started_timer == NULL )
            {
                d->app_started_timer = new QTimer( this );
                connect( d->app_started_timer, SIGNAL(timeout()), SLOT(_k_checkAppStartedSlot()));
            }
            if( !d->app_started_timer->isActive()) {
                d->app_started_timer->setSingleShot( true );
                d->app_started_timer->start( 0 );
            }
        }
    }
    return QApplication::notify(receiver, event);
}