コード例 #1
0
ファイル: trayplugin.cpp プロジェクト: GravisZro/qtpanel
void TrayApplet::onWindowClosed(WId window)
{
  for(QList<CWindowIcon*>::iterator pos = m_icons.begin(); pos != m_icons.end(); pos++)
  {
    if(**pos == window)
    {
      layout()->removeWidget(*pos);
      delete *pos;
      m_icons.erase(pos);
      updateLayout();
      break;
    }
  }
}
コード例 #2
0
void MusicBar::setInsertSymbolFromCursor()
{
    /*! @todo There has to be something to get all Embellishments, or else
      * this code has to be modified for every new Embellishmet
      */
    int t_insSymType = 0;
    if(m_insertSymbol != 0){
        t_insSymType = m_insertSymbol->type();
    }
    if(m_cursor != 0){
        int type = m_cursor->type();
        switch(type){
            case MelodyNoteType: {
                    const MelodyNote *note = qgraphicsitem_cast<const MelodyNote *>(m_cursor);
                    m_insertSymbol = new MelodyNote(note->pitchList(), note->pen(), note->pitch(), note->length()->length());
                    m_insertSymbol->setVisible(true);
                break;
            }
            case DoublingType: {
                    const Doubling *dbl = qgraphicsitem_cast<const Doubling *>(m_cursor);
                    m_insertSymbol = new Doubling(dbl->pitchList(), dbl->pen());
                break;
            }
            case SingleGraceType: {
                    const SingleGrace *grace = qgraphicsitem_cast<const SingleGrace *>(m_cursor);
                    m_insertSymbol = new SingleGrace(grace->pitchList(), grace->pen());
                break;
            }
        case GripType: {
                const Grip *grip = qgraphicsitem_cast<const Grip *>(m_cursor);
                m_insertSymbol = new Grip(grip->pitchList(), grip->pen());
            }
        }
        m_insertSymbol->setHovermode(true);
        m_insertSymbol->setFlags(QGraphicsItem::ItemIsFocusable);
        m_insertSymbol->setFocus(Qt::MouseFocusReason);
    } else {
        if(m_cursorIdx != -1){
            removeSymbol(m_cursorIdx);
            updateLayout();
            m_cursorIdx = -1;
            m_stemDrawer->update(m_stemDrawer->boundingRect());
        }
        if(m_insertSymbol != 0){
            delete m_insertSymbol;
            m_insertSymbol = 0;
        }
    }
}
コード例 #3
0
/*!
  \brief Adds handling of layout requests
  \param event Event

  \return See QFrame::event()
*/
bool QwtPlot::event( QEvent *event )
{
    bool ok = QFrame::event( event );
    switch ( event->type() )
    {
        case QEvent::LayoutRequest:
            updateLayout();
            break;
        case QEvent::PolishRequest:
            replot();
            break;
        default:;
    }
    return ok;
}
コード例 #4
0
void	LLAccordionCtrlTab::onScrollPosChangeCallback(S32, LLScrollbar*)
{
	LLRect child_rect;

	S32 width = getRect().getWidth();
	S32 height = getRect().getHeight();

	child_rect.setLeftTopAndSize(
		getPaddingLeft(),
		height - getHeaderHeight() - getPaddingTop(),
		width - getPaddingLeft() - getPaddingRight(), 
		height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() );

	updateLayout(child_rect);
}
コード例 #5
0
ファイル: UIView.cpp プロジェクト: YurieCo/Nephilim
void UIView::setPosition(float x, float y)
{
	// Offset children
	vec2 offset = vec2(x,y) - getPosition();

	// -- update the top-left position of this control
	mRect.left = x;
	mRect.top = y;

	updateLayout();

	offsetChildrenPosition(offset);

	onPositionChanged();
}
コード例 #6
0
void KPager::slotNumberOfDesktopsChanged(int ndesktops)
{
    unsigned int nDesktops=static_cast<unsigned int>(ndesktops);
    if (nDesktops<m_desktops.count())
    {
        QValueList <Desktop *>::Iterator it;
        for ( int i=m_desktops.count()-nDesktops; i > 0; i--)
        {
            it = m_desktops.fromLast();
            delete (*it);
            m_desktops.remove(it);
        }

        emit updateLayout();
    }
    else if (nDesktops>m_desktops.count())
    {
        int i,j;
        i=j=m_desktops.count();
        switch (m_layoutType)
        {
            case (Classical) :  i%=2;j/=2; break;
            case (Horizontal) : i=0; break;
            case (Vertical) :   j=0; break;
        }

        for (unsigned int d=m_desktops.count()+1;d<=nDesktops; d++)
        {
            Desktop *dsk=new Desktop(d,kwin()->desktopName(d-1),this);
            m_desktops.append(dsk);
            dsk->show();
        }

        emit updateLayout();
    }
}
コード例 #7
0
    //__________________________________________________________________
    bool StyleConfig::eventFilter( QObject* object, QEvent* event )
    {

        switch( event->type() )
        {

            case QEvent::ShowToParent:
            object->event( event );
            updateLayout();
            return true;

            default:
            return false;
        }
    }
コード例 #8
0
ファイル: juce_AlertWindow.cpp プロジェクト: Amcut/pizmidi
Component* AlertWindow::removeCustomComponent (const int index)
{
    Component* const c = getCustomComponent (index);

    if (c != nullptr)
    {
        customComps.removeFirstMatchingValue (c);
        allComps.removeFirstMatchingValue (c);
        removeChildComponent (c);

        updateLayout (false);
    }

    return c;
}
コード例 #9
0
ファイル: editor.cpp プロジェクト: Sybn/supercollider
GenericCodeEditor::GenericCodeEditor( Document *doc, QWidget *parent ):
    QPlainTextEdit( parent ),
    mDoc(doc)
{
    Q_ASSERT(mDoc != 0);

    setFrameShape( QFrame::NoFrame );

    mLineIndicator = new LineIndicator(this);
    mLineIndicator->move( contentsRect().topLeft() );

    mOverlay = new QGraphicsScene(this);

    QGraphicsView *overlayView = new QGraphicsView(mOverlay, this);
    overlayView->setFrameShape( QFrame::NoFrame );
    overlayView->setBackgroundBrush( Qt::NoBrush );
    overlayView->setStyleSheet("background: transparent");
    overlayView->setFocusPolicy( Qt::NoFocus );
    overlayView->setAttribute(Qt::WA_TransparentForMouseEvents, true);
    overlayView->setSceneRect(QRectF(0,0,1,1));
    overlayView->setAlignment(Qt::AlignLeft | Qt::AlignTop);

    mOverlayWidget = overlayView;

    connect( mDoc, SIGNAL(defaultFontChanged()), this, SLOT(onDocumentFontChanged()) );

    connect( this, SIGNAL(blockCountChanged(int)),
             mLineIndicator, SLOT(setLineCount(int)) );

    connect( mLineIndicator, SIGNAL( widthChanged() ),
             this, SLOT( updateLayout() ) );

    connect( this, SIGNAL(updateRequest(QRect,int)),
             this, SLOT(updateLineIndicator(QRect,int)) );

    connect( this, SIGNAL(selectionChanged()),
             mLineIndicator, SLOT(update()) );

    connect( Main::instance(), SIGNAL(applySettingsRequest(Settings::Manager*)),
             this, SLOT(applySettings(Settings::Manager*)) );

    QTextDocument *tdoc = doc->textDocument();
    QPlainTextEdit::setDocument(tdoc);
    onDocumentFontChanged();
    mLineIndicator->setLineCount(blockCount());

    applySettings( Main::settings() );
}
コード例 #10
0
ファイル: EditCommand.cpp プロジェクト: 13W/phantomjs
void EditCommand::apply()
{
    ASSERT(m_document);
    ASSERT(m_document->frame());
 
    Frame* frame = m_document->frame();
    
    if (isTopLevelCommand()) {
        if (!endingSelection().isContentRichlyEditable()) {
            switch (editingAction()) {
                case EditActionTyping:
                case EditActionPaste:
                case EditActionDrag:
                case EditActionSetWritingDirection:
                case EditActionCut:
                case EditActionUnspecified:
                    break;
                default:
                    ASSERT_NOT_REACHED();
                    return;
            }
        }
    }
    
    // Changes to the document may have been made since the last editing operation that 
    // require a layout, as in <rdar://problem/5658603>.  Low level operations, like 
    // RemoveNodeCommand, don't require a layout because the high level operations that 
    // use them perform one if one is necessary (like for the creation of VisiblePositions).
    if (isTopLevelCommand())
        updateLayout();

    {
        EventQueueScope scope;
        DeleteButtonController* deleteButtonController = frame->editor()->deleteButtonController();
        deleteButtonController->disable();
        doApply();
        deleteButtonController->enable();
    }

    if (isTopLevelCommand()) {
        // Only need to call appliedEditing for top-level commands, and TypingCommands do it on their
        // own (see TypingCommand::typingAddedToOpenCommand).
        if (!isTypingCommand())
            frame->editor()->appliedEditing(this);
    }

    setShouldRetainAutocorrectionIndicator(false);
}
コード例 #11
0
/*!
  \brief Event filter

  The plot handles the following events for the canvas:

  - QEvent::Resize
    The canvas margins might depend on its size

  - QEvent::ContentsRectChange
    The layout needs to be recalculated

  \param object Object to be filtered
  \param event Event

  \return See QFrame::eventFilter()

  \sa updateCanvasMargins(), updateLayout()
*/
bool QwtPlot::eventFilter( QObject *object, QEvent *event )
{
    if ( object == d_data->canvas )
    {
        if ( event->type() == QEvent::Resize )
        {
            updateCanvasMargins();
        }
        else if ( event->type() == QEvent::ContentsRectChange )
        {
            updateLayout();
        }
    }

    return QFrame::eventFilter( object, event );
}
コード例 #12
0
void LLAccordionCtrlTab::adjustContainerPanel(const LLRect& child_rect)
{
	if(!mContainerPanel)
		return; 

	if(!mFitPanel)
	{
		show_hide_scrollbar(child_rect);
		updateLayout(child_rect);
	}
	else
	{
		mContainerPanel->reshape(child_rect.getWidth(),child_rect.getHeight());
		mContainerPanel->setRect(child_rect);
	}
}
コード例 #13
0
ファイル: previewlayout.cpp プロジェクト: UIKit0/digikam
void SinglePhotoPreviewLayout::updateZoomAndSize()
{
    // Set zoom for fit-in-window as minimum, but don't scale up images
    // that are smaller than the available space, only scale down.
    double fitZoom = d->zoomSettings()->fitToSizeZoomFactor(d->frameSize(), ImageZoomSettings::OnlyScaleDown);
    setMinZoomFactor(fitZoom);
    setMaxZoomFactor(12.0);

    // Is currently the zoom factor set to fit to window? Then set it again to fit the new size.
    if (zoomFactor() <= fitZoom || d->isFitToWindow)
    {
        fitToWindow();
    }

    updateLayout();
}
コード例 #14
0
void
CQSplitterArea::
setDockArea(Qt::DockWidgetArea dockArea)
{
  dockArea_ = dockArea;

  if (isVerticalDockArea())
    splitter()->setOrientation(Qt::Vertical);
  else
    splitter()->setOrientation(Qt::Horizontal);

  handle_->updateState();

  if (isVisible())
    updateLayout();
}
コード例 #15
0
CQSplitterArea::
CQSplitterArea(CQPaletteArea *palette) :
 QWidget(0), palette_(palette), dockArea_(Qt::LeftDockWidgetArea),
 resizable_(true), floating_(false)
{
  splitter_ = new QSplitter(this);

  splitter_->setObjectName("splitter");

  handle_ = new CQSplitterHandle(this);

  handle_->setObjectName(QString("%1_handle").arg(palette_->objectName()));

  if (isVisible())
    updateLayout();
}
コード例 #16
0
void MusicBar::keyPressEvent(QKeyEvent *event)
{
    //qDebug() << "MusicBar Key press event";
    if(event->key() == Qt::Key_Delete){
        for(int i=0; i<m_symbols.size(); i++){
            Symbol *t_sym = m_symbols.at(i);
            if(t_sym->hasFocus()){
                removeSymbol(i);
                delete t_sym;
            }
        }
        updateLayout();
    } else {
        event->ignore();
    }
}
コード例 #17
0
ファイル: qwt_plot.cpp プロジェクト: ahinoamp/Research
/*!
  \brief Adds handling of QEvent::LayoutHint
*/
bool QwtPlot::event(QEvent *e)
{
    bool ok = QFrame::event(e);
    switch(e->type())
    {
#if 0
        case QEvent::ChildInserted:
        case QEvent::ChildRemoved:
#endif
        case QEvent::LayoutHint:
            updateLayout();
            break;
        default:;
    }
    return ok;
}
コード例 #18
0
ファイル: juce_AlertWindow.cpp プロジェクト: Amcut/pizmidi
//==============================================================================
void AlertWindow::addComboBox (const String& name,
                               const StringArray& items,
                               const String& onScreenLabel)
{
    ComboBox* const cb = new ComboBox (name);
    comboBoxes.add (cb);
    allComps.add (cb);

    cb->addItemList (items, 1);

    addAndMakeVisible (cb);
    cb->setSelectedItemIndex (0);

    comboBoxNames.add (onScreenLabel);
    updateLayout (false);
}
コード例 #19
0
ファイル: SToolBar.cpp プロジェクト: Blzut3/SLADE
/* SToolBar::addGroup
 * Adds [group] to the toolbar
 *******************************************************************/
void SToolBar::addGroup(SToolBarGroup* group)
{
	// Set the group's parent
	group->SetParent(this);

	// Set background colour
	group->SetBackgroundColour(GetBackgroundColour());

	// Add it to the list of groups
	groups.push_back(group);

	// Update layout
	updateLayout(true);

	Bind(wxEVT_STOOLBAR_BUTTON_CLICKED, &SToolBar::onButtonClick, this, group->GetId());
}
コード例 #20
0
LLComboBox::LLComboBox(	const std::string& name, const LLRect &rect, const std::string& label,
	void (*commit_callback)(LLUICtrl*,void*),
	void *callback_userdata
	)
:	LLUICtrl(name, rect, TRUE, commit_callback, callback_userdata, 
			 FOLLOWS_LEFT | FOLLOWS_TOP),
	mTextEntry(NULL),
	mArrowImage(NULL),
	mAllowTextEntry(FALSE),
	mMaxChars(20),
	mTextEntryTentative(TRUE),
	mListPosition(BELOW),
	mPrearrangeCallback( NULL ),
	mTextEntryCallback( NULL )
{
	// Always use text box 
	// Text label button
	mButton = new LLButton(label,
								LLRect(), 
								LLStringUtil::null,
								NULL, this);
	mButton->setImageUnselected(std::string("square_btn_32x128.tga"));
	mButton->setImageSelected(std::string("square_btn_selected_32x128.tga"));
	mButton->setImageDisabled(std::string("square_btn_32x128.tga"));
	mButton->setImageDisabledSelected(std::string("square_btn_selected_32x128.tga"));
	mButton->setScaleImage(TRUE);

	mButton->setMouseDownCallback(onButtonDown);
	mButton->setFont(LLFontGL::sSansSerifSmall);
	mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
	mButton->setHAlign( LLFontGL::LEFT );
	mButton->setRightHPad(2);
	addChild(mButton);

	// disallow multiple selection
	mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(), 
								 &LLComboBox::onItemSelected, this, FALSE);
	mList->setVisible(FALSE);
	mList->setBgWriteableColor( LLColor4(1,1,1,1) );
	mList->setCommitOnKeyboardMovement(FALSE);
	addChild(mList);

	mArrowImage = LLUI::sImageProvider->getUIImage("combobox_arrow.tga");
	mButton->setImageOverlay("combobox_arrow.tga", LLFontGL::RIGHT);

	updateLayout();
}
コード例 #21
0
//==============================================================================
void AlertWindow::addComboBox (const String& name,
                               const StringArray& items,
                               const String& onScreenLabel)
{
    ComboBox* const cb = new ComboBox (name);
    comboBoxes.add (cb);
    allComps.add (cb);

    for (int i = 0; i < items.size(); ++i)
        cb->addItem (items[i], i + 1);

    addAndMakeVisible (cb);
    cb->setSelectedItemIndex (0);

    comboBoxNames.add (onScreenLabel);
    updateLayout (false);
}
コード例 #22
0
void FoldablePanel::addSection (const String& sectionTitle,
                                Component* const newPanel,
                                const Colour sectionColour,
                                const int sectionHeight,
                                ParamStepped<eSectionState>* sectionState,
                                const int indexToInsertAt)
{
    jassert (sectionTitle.isNotEmpty());

    if (isEmpty()) {
        repaint();
    }

    panelHolderComponent->insertSection (indexToInsertAt, new SectionComponent (sectionTitle, newPanel, sectionColour, sectionHeight, sectionState));
    resized();
    updateLayout();
}
コード例 #23
0
void OverlayUserGroup::wheelEvent(QGraphicsSceneWheelEvent *event) {
	event->accept();

	qreal scale = 0.875f;

	if (event->delta() > 0)
		scale = 1.0f / 0.875f;

	if ((scale < 1.0f) && (os->fZoom <= (1.0f / 4.0f)))
		return;
	else if ((scale > 1.0f) && (os->fZoom >= 4.0f))
		return;

	os->fZoom *= scale;

	updateLayout();
}
コード例 #24
0
ファイル: SToolBar.cpp プロジェクト: DemolisherOfSouls/SLADE
void SToolBar::addActionGroup(string name, wxArrayString actions)
{
	// Do nothing if no actions were given
	if (actions.size() == 0)
		return;

	// Create new toolbar group
	SToolBarGroup* group = new SToolBarGroup(this, name);
	groups.push_back(group);

	// Add actions to the group
	for (unsigned a = 0; a < actions.size(); a++)
		group->addActionButton(actions[a]);

	// Update layout
	updateLayout(true);
}
コード例 #25
0
ファイル: tkaction.cpp プロジェクト: RainerBlessing/KTagebuch
QWidget* TKAction::createLayout(QWidget* parent, QWidget* children)
{
  QWidget* base = new QWidget(parent,"KTToolBarLayout");
  QLabel* textLabel = new QLabel(base,"text");
  textLabel->setMinimumHeight(1);
  QLabel* pixLabel = new QLabel(base,"pixmap");
  children->reparent(base,QPoint(0,0));
  children->setName("widget");
  QHBoxLayout* layout = new QHBoxLayout(base,0,3);
  layout->setResizeMode(QLayout::Minimum);
  layout->addWidget(textLabel);
  layout->addWidget(pixLabel);
  layout->addWidget(children,1);

  updateLayout(base);
  return base;
}
コード例 #26
0
ファイル: OsuPauseMenu.cpp プロジェクト: Simonas1122/McOsu
void OsuPauseMenu::setVisible(bool visible)
{
	m_bVisible = visible;

	// reset
	m_selectedButton = NULL;
	m_bInitialWarningArrowFlyIn = true;
	m_fWarningArrowsAnimAlpha = 0.0f;

	if (m_bVisible)
	{
		updateButtons();
		updateLayout();
	}

	m_osu->updateConfineCursor();
}
コード例 #27
0
ファイル: tdeaboutdialog.cpp プロジェクト: Fat-Zer/tdelibs
TDEAboutContributor::TDEAboutContributor( TQWidget *_parent, const char *wname,
			              const TQString &_name,const TQString &_email,
			              const TQString &_url, const TQString &_work,
			              bool showHeader, bool showFrame,
				      bool showBold )
  : TQFrame( _parent, wname ), mShowHeader(showHeader), mShowBold(showBold), d(0)
{
  if( showFrame )
  {
    setFrameStyle(TQFrame::Panel | TQFrame::Raised);
  }

  mLabel[0] = new TQLabel( this );
  mLabel[1] = new TQLabel( this );
  mLabel[2] = new TQLabel( this );
  mLabel[3] = new TQLabel( this );
  mText[0] = new TQLabel( this );
  mText[1] = new KURLLabel( this );
  mText[2] = new KURLLabel( this );
  mText[3] = new TQLabel( this );

  setName( _name, i18n("Author"), false );
  setEmail( _email, i18n("Email"), false );
  setURL( _url, i18n("Homepage"), false );
  setWork( _work, i18n("Task"), false );

  KURLLabel *kurl = static_cast<KURLLabel *>(mText[1]);
  kurl->setFloat(true);
  kurl->setUnderline(true);
  kurl->setMargin(0);
  connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)),
	  TQT_SLOT(emailClickedSlot(const TQString &)));

  kurl = static_cast<KURLLabel *>(mText[2]);
  kurl->setFloat(true);
  kurl->setUnderline(true);
  kurl->setMargin(0);
  connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)),
	  TQT_SLOT(urlClickedSlot(const TQString &)));

  mLabel[3]->setAlignment( AlignTop );

  fontChange( font() );
  updateLayout();
}
コード例 #28
0
ファイル: juce_AlertWindow.cpp プロジェクト: Amcut/pizmidi
//==============================================================================
void AlertWindow::addTextEditor (const String& name,
                                 const String& initialContents,
                                 const String& onScreenLabel,
                                 const bool isPasswordBox)
{
    AlertWindowTextEditor* const tc = new AlertWindowTextEditor (name, isPasswordBox);
    textBoxes.add (tc);
    allComps.add (tc);

    tc->setColour (TextEditor::outlineColourId, findColour (ComboBox::outlineColourId));
    tc->setFont (getLookAndFeel().getAlertWindowMessageFont());
    tc->setText (initialContents);
    tc->setCaretPosition (initialContents.length());
    addAndMakeVisible (tc);
    textboxNames.add (onScreenLabel);

    updateLayout (false);
}
コード例 #29
0
void TagFilterWidget::onTagAdded(const QString& name, TagFilter::Action action)
{
	TagWidget* widget = new TagWidget(name, action, this);
	widget->show();
	widgets_.append(widget);

	connect(widget,
			SIGNAL(changed(QString,TagFilter::Action)),
			filter_,
			SLOT(setTag(QString,TagFilter::Action)));

	connect(widget,
			SIGNAL(removed(QString)),
			filter_,
			SLOT(removeTag(QString)));

	updateLayout();
}
void MainWindow::on_renderingCheckBox_stateChanged(int state )
{
    iTimer->stop();
    if( state == Qt::Unchecked )
    {
        ui->rendererName->setEnabled( false );
        ui->rendererUid->setEnabled( false );
        ui->comboBox->setEnabled( true );
        updateLayout();
    }
    else if ( state == Qt::Checked)
    {
        ui->rendererName->setEnabled( true );
        ui->rendererUid->setEnabled( true);
        ui->comboBox->setEnabled( false );
    }

}