Esempio n. 1
0
KNCollectionView::KNCollectionView(QWidget *parent, const char *name) :
    KFolderTree(parent, name),
    mActiveItem(0),
    mPopup(0)
{
    setDragEnabled(true);
    addAcceptableDropMimetype("x-knode-drag/article", false);
    addAcceptableDropMimetype("x-knode-drag/folder", true);
    addColumn(i18n("Name"), 162);
    setDropHighlighter(true);

    // popup menu to enable/disable unread and total columns
    header()->setClickEnabled(true);
    header()->installEventFilter(this);
    mPopup = new KPopupMenu(this);
    mPopup->insertTitle(i18n("View Columns"));
    mPopup->setCheckable(true);
    mUnreadPop = mPopup->insertItem(i18n("Unread Column"), this, SLOT(toggleUnreadColumn()));
    mTotalPop = mPopup->insertItem(i18n("Total Column"), this, SLOT(toggleTotalColumn()));

    // add unread and total columns if necessary
    readConfig();

    // load accounts and folders
    reloadAccounts();
    reloadFolders();

    // connect to the account manager
    KNAccountManager *am = knGlobals.accountManager();
    connect(am, SIGNAL(accountAdded(KNNntpAccount *)), SLOT(addAccount(KNNntpAccount *)));
    connect(am, SIGNAL(accountRemoved(KNNntpAccount *)), SLOT(removeAccount(KNNntpAccount *)));
    connect(am, SIGNAL(accountModified(KNNntpAccount *)), SLOT(updateAccount(KNNntpAccount *)));

    // connect to the group manager
    KNGroupManager *gm = knGlobals.groupManager();
    connect(gm, SIGNAL(groupAdded(KNGroup *)), SLOT(addGroup(KNGroup *)));
    connect(gm, SIGNAL(groupRemoved(KNGroup *)), SLOT(removeGroup(KNGroup *)));
    connect(gm, SIGNAL(groupUpdated(KNGroup *)), SLOT(updateGroup(KNGroup *)));

    // connect to the folder manager
    KNFolderManager *fm = knGlobals.folderManager();
    connect(fm, SIGNAL(folderAdded(KNFolder *)), SLOT(addPendingFolders()));
    connect(fm, SIGNAL(folderRemoved(KNFolder *)), SLOT(removeFolder(KNFolder *)));
    connect(fm, SIGNAL(folderActivated(KNFolder *)), SLOT(activateFolder(KNFolder *)));

    installEventFilter(this);
}
Esempio n. 2
0
DialogWait::DialogWait(QWidget *parent, bool animation, bool closeBtnHint) :
    QDialog(parent, Qt::FramelessWindowHint),
    animationHint(animation),
    isAltF4Flag(false),
    cycl(NULL), labelText(NULL), closeBtn(NULL),
    alpha(int(255 * 0.75))
{
    setAttribute(Qt::WA_TranslucentBackground);

    // cycl
    cycl = new ZCyclProgress(":/images/loading.png", 6, this);
    cycl->setFixedSize(QPixmap(":/images/loading.png").size());

    // text
    labelText = new QLabel(this);
    labelText->setStyleSheet("color: white;");

    // close btn
    closeBtn = new QPushButton(tr("Cancel"), this);
    closeBtn->setObjectName("closeBtn");
    closeBtn->setStyleSheet("#closeBtn {background-color: transparent; border: none; font: 12px; color: #33B6FF;}");
    closeBtn->setMinimumSize(40, 15);
    closeBtn->setMaximumSize(40, 15);
    connect(closeBtn, SIGNAL(clicked()), SIGNAL(signal_cancel()));
    connect(closeBtn, SIGNAL(clicked()), SLOT(close()));
    closeBtn->setVisible(closeBtnHint);

    // layout
    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setSpacing(6);
    layout->setContentsMargins(9, 9, 9, 9);
    layout->addItem(new QSpacerItem(0, 40, QSizePolicy::Expanding, QSizePolicy::Preferred));
    layout->addWidget(cycl);
    layout->addWidget(labelText);
    if (closeBtnHint) {
        layout->addItem(new QSpacerItem(0, 40, QSizePolicy::Expanding, QSizePolicy::Preferred));
    }
    layout->addWidget(closeBtn);
    layout->setAlignment(closeBtn, Qt::AlignCenter);
    layout->addItem(new QSpacerItem(0, 40, QSizePolicy::Expanding, QSizePolicy::Preferred));
    setLayout(layout);

    installEventFilter(this);
    closeBtn->installEventFilter(this);

    setStyleSheet("QDialog {border: none;}");
}
Esempio n. 3
0
ImageDockerDock::ImageDockerDock():
    QDockWidget(i18n("Reference Images")),
    m_canvas(0),
    m_currImageID(-1)
{
    m_ui           = new ImageDockerUI();
    m_popupUi      = new PopupWidgetUI();
    m_zoomButtons  = new QButtonGroup();
    m_imgListModel = new ImageListModel();
    m_thumbModel   = new KisImageStripScene();
    m_model        = new QFileSystemModel();
    m_proxyModel   = new ImageFilter();
    m_proxyModel->setSourceModel(m_model);
    m_proxyModel->setDynamicSortFilter(true);

    m_ui->bnBack->setIcon(koIcon("go-previous"));
    m_ui->bnUp->setIcon(koIcon("go-up"));
    m_ui->bnHome->setIcon(koIcon("go-home"));
    m_ui->bnImgPrev->setIcon(koIcon("go-previous"));
    m_ui->bnImgNext->setIcon(koIcon("go-next"));
    m_ui->bnImgClose->setIcon(koIcon("window-close"));
    m_ui->thumbView->setScene(m_thumbModel);
    m_ui->treeView->setModel(m_proxyModel);
    m_ui->cmbImg->setModel(m_imgListModel);
    m_ui->bnPopup->setIcon(koIcon("zoom-original"));
    m_ui->bnPopup->setPopupWidget(m_popupUi);
    
    m_popupUi->zoomSlider->setRange(5, 500);
    m_popupUi->zoomSlider->setValue(100);

    m_zoomButtons->addButton(m_popupUi->bnZoomFit   , KisImageView::VIEW_MODE_FIT);
    m_zoomButtons->addButton(m_popupUi->bnZoomAdjust, KisImageView::VIEW_MODE_ADJUST);
    m_zoomButtons->addButton(m_popupUi->bnZoom25    , 25);
    m_zoomButtons->addButton(m_popupUi->bnZoom50    , 50);
    m_zoomButtons->addButton(m_popupUi->bnZoom75    , 75);
    m_zoomButtons->addButton(m_popupUi->bnZoom100   , 100);
    
    installEventFilter(this);

    m_ui->cmbPath->addItem(koIcon("folder-image"), QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
    m_ui->cmbPath->addItem(koIcon("folder-documents"), QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
    m_ui->cmbPath->addItem(koIcon("user-home"), QDesktopServices::storageLocation(QDesktopServices::HomeLocation));

    foreach(const QFileInfo &info, QDir::drives()) {
        m_ui->cmbPath->addItem(koIcon("drive-harddisk"), info.absolutePath());
    }
Esempio n. 4
0
CroppingLabel::CroppingLabel(QWidget* parent)
    : QLabel(parent)
    , blockPaintEvents(false)
    , editable(false)
    , elideMode(Qt::ElideRight)
{
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

    textEdit = new QLineEdit(this);
    textEdit->hide();
    textEdit->setInputMethodHints(Qt::ImhNoAutoUppercase
                                  | Qt::ImhNoPredictiveText
                                  | Qt::ImhPreferLatin);

    installEventFilter(this);
    textEdit->installEventFilter(this);
}
Esempio n. 5
0
ChatTextEdit::ChatTextEdit(QWidget *parent) :
    QTextEdit(parent)
{
    QFontMetrics metrics(currentFont());
    fontHeight = metrics.height();

    isEmojiWidgetOpen = false;
    isComposing = false;

    connect(&composingTimer,SIGNAL(timeout()),
            this,SLOT(verifyPaused()));

    connect(this,SIGNAL(textChanged()),
            this,SLOT(textChanged()));

    installEventFilter(this);
}
Esempio n. 6
0
void FlowViewWindow::showEvent(QShowEvent* event)
{
    QDialog::showEvent(event);

    installEventFilter(this);

    readSettings();

    refreshIDList();
    if (ui->listFrameID->count() > 0)
    {
        changeID(ui->listFrameID->item(0)->text());
        ui->listFrameID->setCurrentRow(0);
    }
    updateFrameLabel();
    qDebug() << "FlowView show event was processed";
}
Esempio n. 7
0
MENU_KERNEL::MENU_KERNEL ( QWidget * parent ) : QMainWindow ( parent )
{
    SET_BUTTON_TEXT_POS ( BUTTON_ICON_YOK );
    SET_ICON_SIZE ( 1, 1 );
    SET_THIS(this);

    HIDE_MENU_ACTIONS();
    SHOW_BUTTON_COLUMN_HEADER();

    m_main_widget = NULL;

    m_default_style_sheet = "";

    SET_ICON_SIZE ( 32 , 32 );

    installEventFilter(this);
}
Esempio n. 8
0
QuickButton::QuickButton(const QString &u, KAction* configAction, 
                         QWidget *parent, const char *name) : 
     QButton(parent, name),
     m_flashCounter(0),
     m_sticky(false)
{
    installEventFilter(KickerTip::the());
    if (parent && ! parent->parent())
    {
        setBackgroundMode(X11ParentRelative);
    }
    setBackgroundOrigin( AncestorOrigin );
    setMouseTracking(true);
    _highlight = false;
    _oldCursor = cursor();
    _qurl=new QuickURL(u);
    
    QToolTip::add(this, _qurl->name());
    resize(int(DEFAULT_ICON_DIM),int(DEFAULT_ICON_DIM));
    QBrush bgbrush(colorGroup().brush(QColorGroup::Background));
    
    QuickAddAppsMenu *addAppsMenu = new QuickAddAppsMenu(
        parent, this, _qurl->url());
    _popup = new QPopupMenu(this);
    _popup->insertItem(i18n("Add Application"), addAppsMenu);
    configAction->plug(_popup);
        _popup->insertSeparator();
    _popup->insertItem(SmallIcon("remove"), i18n("Remove"), 
            this, SLOT(removeApp()));

    m_stickyAction = new KToggleAction(i18n("Never Remove Automatically"),
        KShortcut(), this);
    connect(m_stickyAction, SIGNAL(toggled(bool)), 
        this, SLOT(slotStickyToggled(bool)));
    m_stickyAction->plug(_popup, 2);
    m_stickyId = _popup->idAt(2);

    settingsChanged(KApplication::SETTINGS_MOUSE);
    connect(kapp, SIGNAL(settingsChanged(int)), SLOT(settingsChanged(int)));
    connect(kapp, SIGNAL(iconChanged(int)), SLOT(iconChanged(int)));
    connect(this, SIGNAL(clicked()), SLOT(launch()));
    connect(this, SIGNAL(removeApp(QuickButton *)), parent,
        SLOT(removeAppManually(QuickButton *)));
    kapp->addKipcEventMask(KIPC::SettingsChanged);
    kapp->addKipcEventMask(KIPC::IconChanged);
}
Esempio n. 9
0
patternWindow::patternWindow(windowManager* winMgr)
  : imageSaverWindow(tr("Symbols"), winMgr), pdfSymbolDim_(0),
    curImage_(patternImagePtr(NULL)),
    fontMetrics_(QFontMetrics(font())) {

  installEventFilter(this);
  imageLabel_ = new patternImageLabel(this);
  imageLabel_->setGridColor(Qt::black);
  connect(imageLabel_, SIGNAL(announceImageClick(QMouseEvent* )),
          this, SLOT(imageClickSlot(QMouseEvent* )));
  scroll_ = new QScrollArea(this);
  scroll_->installEventFilter(this);
  scroll_->viewport()->installEventFilter(this);
  scroll_->setWidget(imageLabel_);
  setCentralWidget(scroll_);

  dockImageHolder_ = new QDockWidget(this);
  dockImageHolder_->setFeatures(QDockWidget::NoDockWidgetFeatures);
  dockImage_ = new dockImage(winManager()->originalImage(), this);
  dockImageHolder_->setWidget(dockImage_);
  addDockWidget(Qt::RightDockWidgetArea, dockImageHolder_);
  connect(scroll_->horizontalScrollBar(), SIGNAL(valueChanged(int )),
          this, SLOT(labelScrollChange( )));
  connect(scroll_->verticalScrollBar(), SIGNAL(valueChanged(int )),
          this, SLOT(labelScrollChange( )));
  connect(dockImage_, SIGNAL(viewportUpdated(qreal , qreal, bool , bool )),
          this, SLOT(processDockImageUpdate(qreal , qreal, bool , bool )));

  const QFontMetrics metrics(font());
  basePatternDim_ = (metrics.width("@") > metrics.height()) ?
    metrics.width("@") : metrics.height();
  basePatternDim_ = qMax(basePatternDim_, 30);
  listDock_ = new patternDockWidget(basePatternDim_, this);
  setListDockWidget(listDock_);
  connect(listDock_, SIGNAL(changeSymbol(const triC& )),
          this, SLOT(changeSymbolSlot(const triC& )));

  constructActions();
  constructMenus();
  constructToolbar();
  constructPdfViewerDialog();

  setPermanentStatus(tr("Click the 'To pdf' button to save the pattern as a pdf."));
  setStatus(tr("left click: change symbol; right click: switch between square and symbol images"));
}
Esempio n. 10
0
Menu::Menu(QWidget* parent) :
ControlShow(parent),
m_pCustomStyle(nullptr)
{
	ControlBase::setControlShow(this);
	setItemName(L"item");
	m_pCustomStyle = new MenuCustomStyle;
	if (m_pCustomStyle != nullptr)
	{
		setStyle(m_pCustomStyle);
	}
	installEventFilter(this);
	setMouseTracking(true);

	setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
	//背景透明
	setAttribute(Qt::WA_TranslucentBackground);
}
YaExpandingOverlayLineEdit::YaExpandingOverlayLineEdit(QWidget* parent)
	: YaEmptyTextLineEdit(parent)
	, state_(Normal)
	, expandCollapseTimeLine_(0)
	, updateGeometryTimer_(0)
	, controller_(0)
{
	expandCollapseTimeLine_ = new QTimeLine(expandDuration, this);
	connect(expandCollapseTimeLine_, SIGNAL(frameChanged(int)), SLOT(animate()));

	updateGeometryTimer_ = new QTimer(this);
	updateGeometryTimer_->setSingleShot(true);
	updateGeometryTimer_->setInterval(0);
	connect(updateGeometryTimer_, SIGNAL(timeout()), SLOT(recalculateGeometry()));

	installEventFilter(this);
	hide();
}
Esempio n. 12
0
MplayerWindow::MplayerWindow(QWidget* parent, Qt::WindowFlags f) 
	: Screen(parent, f) , allow_video_movement(false)
{
	offset_x = 0;
	offset_y = 0;
	zoom_factor = 1.0;

	setAutoFillBackground(true);
	ColorUtils::setBackgroundColor( this, QColor(0,0,0) );

	mplayerlayer = new MplayerLayer( this );
	mplayerlayer->setAutoFillBackground(TRUE);

	logo = new QLabel( mplayerlayer );
	logo->setAutoFillBackground(TRUE);
#if QT_VERSION >= 0x040400
	logo->setAttribute(Qt::WA_NativeWindow); // Otherwise the logo is not visible in Qt 4.4
#else
	logo->setAttribute(Qt::WA_PaintOnScreen); // Fixes the problem if compiled with Qt < 4.4
#endif
	ColorUtils::setBackgroundColor( logo, QColor(0,0,0) );

	QVBoxLayout * mplayerlayerLayout = new QVBoxLayout( mplayerlayer );
	mplayerlayerLayout->addWidget( logo, 0, Qt::AlignHCenter | Qt::AlignVCenter );

    aspect = (double) 4 / 3;
	monitoraspect = 0;

	setSizePolicy( QSizePolicy::Expanding , QSizePolicy::Expanding );
	setFocusPolicy( Qt::StrongFocus );

	installEventFilter(this);
	mplayerlayer->installEventFilter(this);
	//logo->installEventFilter(this);

#if DELAYED_RESIZE
	resize_timer = new QTimer(this);
	resize_timer->setSingleShot(true);
	resize_timer->setInterval(50);
	connect( resize_timer, SIGNAL(timeout()), this, SLOT(resizeLater()) );
#endif

	retranslateStrings();
}
HelpEditorFindWidget::HelpEditorFindWidget(QWidget *parent)
  : QWidget(parent)
  , appPalette(qApp->palette())
{
  installEventFilter(this);
  QHBoxLayout *hboxLayout = new QHBoxLayout(this);
  QString resourcePath = QLatin1String(":/org.blueberry.ui.qt.help");

#ifndef Q_OS_MAC
  hboxLayout->setMargin(0);
  hboxLayout->setSpacing(6);
#endif

  toolClose = setupToolButton(QLatin1String(""),
                              resourcePath + QLatin1String("/close.png"));
  hboxLayout->addWidget(toolClose);
  connect(toolClose, SIGNAL(clicked()), SLOT(hide()));

  editFind = new QLineEdit(this);
  hboxLayout->addWidget(editFind);
  editFind->setMinimumSize(QSize(150, 0));
  connect(editFind, SIGNAL(textChanged(QString)), this,
          SLOT(textChanged(QString)));
  connect(editFind, SIGNAL(returnPressed()), this, SIGNAL(findNext()));
  connect(editFind, SIGNAL(textChanged(QString)), this, SLOT(updateButtons()));

  toolPrevious = setupToolButton(tr("Previous"),
                                 resourcePath + QLatin1String("/go-previous.png"));
  connect(toolPrevious, SIGNAL(clicked()), this, SIGNAL(findPrevious()));

  hboxLayout->addWidget(toolPrevious);

  toolNext = setupToolButton(tr("Next"),
                             resourcePath + QLatin1String("/go-next.png"));
  hboxLayout->addWidget(toolNext);
  connect(toolNext, SIGNAL(clicked()), this, SIGNAL(findNext()));

  checkCase = new QCheckBox(tr("Case Sensitive"), this);
  hboxLayout->addWidget(checkCase);

  setMinimumWidth(minimumSizeHint().width());

  updateButtons();
}
Esempio n. 14
0
VisualizationFrame::VisualizationFrame( QWidget* parent )
  : QMainWindow( parent )
  , render_panel_(NULL)
  , show_help_action_(NULL)
  , file_menu_(NULL)
  , recent_configs_menu_(NULL)
  , toolbar_(NULL)
  , manager_(NULL)
  , splash_( NULL )
  , position_correction_( 0, 0 )
  , num_move_events_( 0 )
  , toolbar_actions_( NULL )
  , show_choose_new_master_option_( false )
  , add_tool_action_( NULL )
  , remove_tool_menu_( NULL )
  , initialized_( false )
  , geom_change_detector_( new WidgetGeometryChangeDetector( this ))
  , loading_( false )
  , post_load_timer_( new QTimer( this ))
{
  panel_factory_ = new PanelFactory();

  installEventFilter( geom_change_detector_ );
  connect( geom_change_detector_, SIGNAL( changed() ), this, SLOT( setDisplayConfigModified() ));

  post_load_timer_->setSingleShot( true );
  connect( post_load_timer_, SIGNAL( timeout() ), this, SLOT( markLoadingDone() ));

  package_path_ = ros::package::getPath("rviz");
  help_path_ = QString::fromStdString( (fs::path(package_path_) / "help/help.html").BOOST_FILE_STRING() );
  splash_path_ = QString::fromStdString( (fs::path(package_path_) / "images/splash.png").BOOST_FILE_STRING() );

  QToolButton* reset_button = new QToolButton( );
  reset_button->setText( "Reset" );
  reset_button->setContentsMargins(0,0,0,0);
  statusBar()->addPermanentWidget( reset_button, 0 );
  connect( reset_button, SIGNAL( clicked( bool )), this, SLOT( reset() ));

  status_label_ = new QLabel("");
  statusBar()->addPermanentWidget( status_label_, 1 );
  connect( this, SIGNAL( statusUpdate( const QString& )), status_label_, SLOT( setText( const QString& )));

  setWindowTitle( "RViz[*]" );
}
Esempio n. 15
0
SearchWidget::SearchWidget(QWidget *p)
     : QWidget(p)
     , cat(0)
     , widgetIsActive(false)
{
    QGridLayout *l=new QGridLayout(this);
    int spacing=qMin(2, Utils::layoutSpacing(this));
    #ifdef Q_OS_MAC
    l->setSpacing(2);
    l->setContentsMargins(0, spacing, spacing, spacing);
    bool closeOnLeft=true;
    #else
    l->setSpacing(0);
    l->setContentsMargins(0, spacing, 0, spacing);
    bool closeOnLeft=Utils::Unity==Utils::currentDe();
    #endif
    label=new SqueezedTextLabel(this);
    edit=new LineEdit(this);
    edit->setPlaceholderText(i18n("Search..."));
    closeButton=new ToolButton(this);
    closeButton->setToolTip(i18n("Close Search Bar")+QLatin1String(" (")+QKeySequence(Qt::Key_Escape).toString()+QLatin1Char(')'));

    l->addWidget(label, 0, 0, 1, 3);
    if (closeOnLeft) {
        l->addWidget(closeButton, 1, 1);
        l->addWidget(edit, 1, 2);
    } else {
        l->addWidget(edit, 1, 1);
        l->addWidget(closeButton, 1, 2);
    }

    closeButton->setIcon(Icon::std(Icon::Close));
    Icon::init(closeButton);
    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(edit, SIGNAL(textChanged(QString)), SIGNAL(textChanged(QString)));
    connect(edit, SIGNAL(returnPressed()), SIGNAL(returnPressed()));
    installEventFilter(new EscKeyEventHandler(this));
    label->setVisible(false);
    label->setAlignment(Qt::AlignTop);
    QFont f(font());
    f.setBold(true);
    label->setFont(f);
    setTabOrder(edit, closeButton);
}
Esempio n. 16
0
DrugCheck::DrugCheck(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);
	initUI();
	ui.tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
	ui.tableWidget->setStyleSheet("QTableWidget{border: 1px solid gray;	background-color: transparent;	selection-color: grey;}");
	ui.tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section {background-color:white;color: black;padding-left: 4px;border: 1px solid #6c6c6c;};"
		"color: white;padding-left: 4px;border: 1px solid #6c6c6c;}"
		"QHeaderView::section:checked{background-color: white;color: black;}");	
	ui.tableWidget->installEventFilter(this);//注册事件过滤器
	
	list_widget = new QListWidget(this);
	list_widget->setWindowFlags(Qt::FramelessWindowHint);
	list_widget->close();
	installEventFilter(list_widget);

	connect(ui.tableWidget,SIGNAL(cellChanged(int,int)),this,SLOT(getItem(int,int)));
}
Esempio n. 17
0
TextWidget::TextWidget( QWidget *parent, sword::SWModule *module, int numVerses, const QFont *font )
    : QWidget( parent, 0x0, 0x0 )
    , m_module( module )
    , m_numVerses( numVerses )
{
    if ( parent )
        installEventFilter( parent );

    QVBoxLayout *layout = new QVBoxLayout( this, 2, 2 );

    m_textView = new QTextBrowser( this );
    m_textView->installEventFilter( parent );
    m_textView->setMinimumHeight( 20 );
    m_textView->setHScrollBarMode( QTextView::AlwaysOff );
    m_textView->setTextFormat( QTextView::RichText );
    connect( m_textView, SIGNAL(highlighted(const QString &)),
             this, SIGNAL(sigRefClicked(const QString &)) );
    layout->addWidget( m_textView );

    // Set font
    if ( font )
        setFont( *font );

    // Set initial text
    if ( m_module )
    {
        m_isBibleText = !strcmp( module->Type(), "Biblical Texts" );
        if ( m_isBibleText )
        {
            m_key = new sword::VerseKey( "g" );

            //connect( m_textView, SIGNAL(highlighted(const QString&)),
            //         this, SLOT(slotReferenceClicked(const QString&)) );
            //connect( parent, SIGNAL( strongsNumbers( bool ) ), this, SLOT( slotStrongsNumbers( bool ) ) );
        }
        else
        {
            m_key = new sword::SWKey( "" );
        }
        m_module->SetKey( m_key );
        setText();
    }
}
Esempio n. 18
0
InfoBox::InfoBox(ObjectSet *objectSet, QWidget *parent)
    : QTabWidget(parent)
    , _objectSet(objectSet)
{
    installEventFilter(parent);

    addTab(new QWidget(), "Selection");
    addTab(new QWidget(), "Pick");
    addTab(new QWidget(), "Files");

    logBox = new QTextEdit();
    logBox->setReadOnly(true);
    logBox->setFont(QFont("Source Code Pro, monospace", 10));
    addTab(logBox, "Log");

    setCurrentIndex(3);

    QObject::connect(objectSet, &ObjectSet::log, this, &InfoBox::log);
}
Esempio n. 19
0
DatumTextItem::DatumTextItem(Datum* datum, QGraphicsItem* parent)
    : QGraphicsTextItem(parent), d(datum), txt(document()),
      background(Colors::base02), foreground(Colors::base04),
      border(background)
{
    setTextInteractionFlags(Qt::TextEditorInteraction);
    setTextWidth(150);
    connect(datum, &Datum::changed, this, &DatumTextItem::onDatumChanged);
    onDatumChanged();

    bbox = boundingRect();
    connect(txt, &QTextDocument::contentsChanged,
            this, &DatumTextItem::onTextChanged);

    connect(document(), &QTextDocument::undoCommandAdded,
            this, &DatumTextItem::onUndoCommandAdded);

    installEventFilter(this);
}
BackstageComputer::BackstageComputer(QWidget *parent) :
	BackstagePage(parent),
	ui(new Ui::BackstageComputer)
{
	_hasFileName = false;

	ui->setupUi(this);

	_model = new FSBMRecentFolders(this);

	ui->browser->setBrowseMode(FSBrowser::BrowseOpenFolder);
	ui->browser->setViewType(FSBrowser::ListView);
	ui->browser->setFSModel(_model);

	installEventFilter(this);

	connect(ui->browser, SIGNAL(entryOpened(QString)), this, SLOT(selectionMade(QString)));
	connect(ui->browseButton, SIGNAL(clicked(bool)), this, SLOT(browseSelected()));
}
Esempio n. 21
0
MyMdiSubWindow::MyMdiSubWindow(QWidget *parent) :
    QWidget(parent)
{
	widget_ = NULL;

	layout_ = new QVBoxLayout(this);
	layout_->setSpacing(0);
	layout_->setContentsMargins(0, 0, 0, 0);

	MyEventFilter* eventFilter = new MyEventFilter(this);
	connect(eventFilter, SIGNAL(windowTitleChanged(const QString&)), this, SIGNAL(windowTitleChanged(const QString&)));
	connect(eventFilter, SIGNAL(modifiedChanged(bool)), this, SIGNAL(modifiedChanged(bool)));
	installEventFilter(eventFilter);

	closeAction_ = new QAction("Close", this);
	closeAction_->setShortcut( QKeySequence("Ctrl+W"));
	connect(closeAction_, SIGNAL(triggered()), this, SLOT(close()));
	addAction(closeAction_);
}
Esempio n. 22
0
QT_BEGIN_NAMESPACE

HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom)
    : QTextBrowser(parent)
    , zoomCount(zoom)
    , controlPressed(false)
    , lastAnchor(QString())
    , parentWidget(parent)
    , helpEngine(HelpEngineWrapper::instance())
    , forceFont(false)
{
    TRACE_OBJ
    installEventFilter(this);
    document()->setDocumentMargin(8);

    QFont font = viewerFont();
    font.setPointSize(int(font.pointSize() + zoom));
    setViewerFont(font);
}
Esempio n. 23
0
LocationCompleterView::LocationCompleterView()
    : QListView(0)
    , m_ignoreNextMouseMove(false)
{
    setWindowFlags(Qt::Popup);

    setUniformItemSizes(true);
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::SingleSelection);

    setMouseTracking(true);
    installEventFilter(this);

    m_delegate = new LocationCompleterDelegate(this);
    setItemDelegate(m_delegate);
}
Esempio n. 24
0
/*!
    Constructs a menu bar called \a name with parent \a parent.
*/
QMenuBar::QMenuBar( QWidget *parent, const char *name )
    : QFrame( parent, name, WNoAutoErase )
{
#if defined( Q_WS_MAC ) && !defined(QMAC_QMENUBAR_NO_NATIVE)
    mac_eaten_menubar = FALSE;
    mac_d = 0;
    macCreateNativeMenubar();
#endif
    isMenuBar = TRUE;
#ifndef QT_NO_ACCEL
    autoaccel = 0;
#endif
    irects    = 0;
    rightSide = 0; // Right of here is rigth-aligned content
    mseparator = 0;
    waitforalt = 0;
    popupvisible = 0;
    hasmouse = 0;
    defaultup = 0;
    toggleclose = 0;
    pendingDelayedContentsChanges = 0;
    pendingDelayedStateChanges = 0;
    if ( parent ) {
	// filter parent events for resizing
	parent->installEventFilter( this );

	// filter top-level-widget events for accelerators
	QWidget *tlw = topLevelWidget();
	if ( tlw != parent )
	    tlw->installEventFilter( this );
    }
    installEventFilter( this );

    setBackgroundMode( PaletteButton );
    setFrameStyle( QFrame::MenuBarPanel | QFrame::Raised );

    QFontMetrics fm = fontMetrics();
    int h = 2*motifBarVMargin + fm.height() + motifItemVMargin + 2*frameWidth() + 2*motifItemFrame;

    setGeometry( 0, 0, width(), h );

    setMouseTracking( style().styleHint(QStyle::SH_MenuBar_MouseTracking) );
}
Esempio n. 25
0
CDialogCut::CDialogCut(QWidget *parent)
: NoFlameDlg(parent), m_nPort(-1)
{
	ui.setupUi(this);

	CDialogConfig::ReadConfigXml();
	ui.lineEditDstPath->setText(CDialogConfig::m_strCutPath);
	m_strDstPath = CDialogConfig::m_strCutPath;

	m_PlayWnd = new CWidgetPlayWnd(0, this);
	m_PlayWndTest = new CWidgetPlayWnd(1, this);
	m_PlayCtrl = new CFormPlayCtrl(0, m_PlayWnd, this);
	m_PlayCtrlTest = new CFormPlayCtrl(1, m_PlayWndTest, this);
	m_PlayWndTest->hide();
	m_PlayCtrlTest->hide();

	m_getProgressTimer = new QTimer(this);

	m_PlayWnd->SetPreViewMode();
	m_PlayWnd->setGeometry(3, 33,930, 440);
	m_PlayCtrl->setGeometry(3, 33 + 440 , 930, 70);
	m_PlayCtrl->HideNotUsedButton(); 

	ui.frame_2->lower();
	ui.frameComboBox->raise();
	ui.progressBar->setDisabled(1);

	connect(ui.BtnFileOpen, SIGNAL(clicked()), this, SLOT(OnBtnFileOpenClick()));

	connect(ui.BtnClose, SIGNAL(clicked()), this, SLOT(OnBtnCloseClick()));
	connect(ui.BtnMin, SIGNAL(clicked()), this, SLOT(OnBtnMinClick()));

	connect(m_getProgressTimer, SIGNAL(timeout()), this, SLOT(TimeGetProgress()));
	connect(ui.BtnStartCut, SIGNAL(clicked()), this, SLOT(OnBtnStartCutClick()));
	connect(ui.BtnCutStop, SIGNAL(clicked()), this, SLOT(OnBtnCutStopClick()));

	connect(ui.BtnFilePath, SIGNAL(clicked()), this, SLOT(OnBtnFilePathClick()));
	connect(ui.BtnTimeStart, SIGNAL(clicked()), this, SLOT(OnBtnTimeStartClick()));
	connect(ui.BtnTimeStop, SIGNAL(clicked()), this, SLOT(OnBtnTimeStopClick()));

	installEventFilter(this);
}
Esempio n. 26
0
FindWidget::FindWidget(QWidget *parent)
  : QFrame(parent)
{
  installEventFilter(this);

  m_toolBar = new QToolBar(this);
  m_toolBar->setIconSize(QSize(16, 16));

  QLabel *label = new QLabel(this);
  label->setPixmap(QPixmap(LS(":/images/search.png")));

  m_editFind = new SLineEdit(this);
  m_editFind->addWidget(label, LineEdit::LeftSide);
  m_editFind->setWidgetSpacing(3);
  m_editFind->installEventFilter(this);

  m_toolBar->addWidget(m_editFind);
  m_previous = m_toolBar->addAction(QIcon(LS(":/images/find_previous.png")), tr("Previous"));
  m_next = m_toolBar->addAction(QIcon(LS(":/images/find_next.png")), tr("Next"));
  m_toolBar->addSeparator();
  m_close = m_toolBar->addAction(QIcon(LS(":/images/stop.png")), tr("Close"));

  QHBoxLayout *mainLay = new QHBoxLayout(this);
  mainLay->addWidget(m_toolBar);

# if defined(Q_OS_MACX)
  mainLay->setMargin(0);
# else
  mainLay->setMargin(4);
# endif

# if defined(Q_OS_WIN32)
  setObjectName(LS("FindWidget"));
  setStyleSheet(QString("FindWidget { background-color:%1; }").arg(palette().color(QPalette::Window).name()));
# endif

  setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

  connect(m_editFind, SIGNAL(returnPressed()), SLOT(find()));
  connect(m_editFind, SIGNAL(textChanged(QString)), SLOT(find()));
  connect(m_toolBar, SIGNAL(actionTriggered(QAction*)), SLOT(actionTriggered(QAction*)));
}
Esempio n. 27
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    qApp->setOrganizationName("Hallo");
    qApp->setApplicationName("Welt");



    QSettings s;
    s.beginGroup("UI");
    restoreGeometry(s.value("geo").toByteArray());
    restoreState(s.value("status").toByteArray());
    s.endGroup();

    installEventFilter(this);
    _pc = 0;
    load(true);

    ObjectManager* t = new ObjectManager(this);
    addManager(t);
    ViewportManager* v = new ViewportManager(this);
    addManager(v);
    PropertyManager* propManager = new PropertyManager(this);
    addManager(propManager);


    ui->objectTreeWidget->setWidget(t);
    ui->attributeWidget->setWidget(propManager);
    setCentralWidget(v);

    connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(load()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save()));
    connect(ui->actionNew, &QAction::triggered, [this]() { load(true); });
    setUpObjectsMenu();
    _renderManager = new RenderManager(this);
    connect(ui->actionRender, SIGNAL(triggered()), this, SLOT(render()));


}
Esempio n. 28
0
void MappingButton::Detect()
{
  if (m_parent->GetDevice() == nullptr || !m_reference->IsInput())
    return;

  installEventFilter(BlockUserInputFilter::Instance());
  grabKeyboard();
  grabMouse();

  // Make sure that we don't block event handling
  std::thread thread([this] {
    const auto dev = m_parent->GetDevice();

    setText(QStringLiteral("..."));

    // Avoid that the button press itself is registered as an event
    Common::SleepCurrentThread(100);

    const auto expr = MappingCommon::DetectExpression(
        m_reference, dev.get(), m_parent->GetController()->GetDefaultDevice());

    releaseMouse();
    releaseKeyboard();
    removeEventFilter(BlockUserInputFilter::Instance());

    if (!expr.isEmpty())
    {
      m_reference->SetExpression(expr.toStdString());
      m_parent->SaveSettings();
      Update();

      if (m_parent->IsIterativeInput())
        m_parent->NextButton(this);
    }
    else
    {
      OnButtonTimeout();
    }
  });

  thread.detach();
}
Esempio n. 29
0
void MarbleWidget::setInputEnabled( bool enabled )
{
    //if input is set as enabled
    if ( enabled )
    {
        if ( !d->m_inputhandler ) {
            d->setInputHandler();
        }
        else {
            installEventFilter( d->m_inputhandler );
        }
    }

    else // input is disabled
    {
        mDebug() << "MarbleWidget::disableInput";
        removeEventFilter( d->m_inputhandler );
        setCursor( Qt::ArrowCursor );
    }
}
Esempio n. 30
0
	QLabel* ShowPixmapLabel (const QPixmap& srcPx, const QPoint& pos)
	{
		const auto& availGeom = QApplication::desktop ()->availableGeometry (pos).size () * 0.9;

		auto px = srcPx;
		if (px.size ().width () > availGeom.width () ||
			px.size ().height () > availGeom.height ())
			px = px.scaled (availGeom, Qt::KeepAspectRatio, Qt::SmoothTransformation);

		auto label = new QLabel;
		label->setWindowFlags (Qt::Tool);
		label->setAttribute (Qt::WA_DeleteOnClose);
		label->setFixedSize (px.size ());
		label->setPixmap (px);
		label->show ();
		label->activateWindow ();
		label->installEventFilter (new AADisplayEventFilter (label));
		label->move (pos);
		return label;
	}