Merge branch 'claudio-dev' into OEFUniboard

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit 312d924ac5
  1. 10
      src/domain/UBGraphicsScene.cpp
  2. 4
      src/domain/UBGraphicsScene.h
  3. 17
      src/domain/UBGraphicsTextItem.cpp
  4. 6
      src/gui/UBDocumentNavigator.cpp
  5. 6
      src/gui/UBDocumentNavigator.h

@ -2188,6 +2188,16 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent)
QList<QGraphicsItem*> si = selectedItems();
if(keyEvent->matches(QKeySequence::SelectAll)){
QListIterator<QGraphicsItem*> itItems(this->mFastAccessItems);
while (itItems.hasNext())
itItems.next()->setSelected(true);
keyEvent->accept();
return;
}
if ((si.size() > 0) && (keyEvent->isAccepted()))
{
#ifdef Q_OS_MAC

@ -356,8 +356,8 @@ public slots:
void recolorAllItems();
virtual void drawItems (QPainter * painter, int numItems,
QGraphicsItem * items[], const QStyleOptionGraphicsItem options[], QWidget * widget = 0);
virtual void drawItems (QPainter * painter, int numItems,
QGraphicsItem * items[], const QStyleOptionGraphicsItem options[], QWidget * widget = 0);
QGraphicsItem* rootItem(QGraphicsItem* item) const;

@ -215,9 +215,12 @@ void UBGraphicsTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
if (widget == UBApplication::boardController->controlView()->viewport() &&
!isSelected() && toPlainText().isEmpty())
{
QFontMetrics fm(font());
setTextWidth(fm.width(mTypeTextHereLabel));
painter->setFont(font());
painter->setPen(UBSettings::paletteColor);
painter->drawText(boundingRect(), Qt::AlignCenter, mTypeTextHereLabel);
setTextInteractionFlags(Qt::NoTextInteraction);
}
}
@ -246,10 +249,6 @@ void UBGraphicsTextItem::copyItemParameters(UBItem *copy) const
cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType));
cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked));
cp->setData(UBGraphicsItemData::ItemEditable, data(UBGraphicsItemData::ItemEditable).toBool());
// cp->setDefaultTextColor(this->defaultTextColor());
// cp->setFont(this->font());
// cp->setColorOnDarkBackground(this->colorOnDarkBackground());
// cp->setColorOnLightBackground(this->colorOnLightBackground());
cp->setTextWidth(this->textWidth());
cp->setTextHeight(this->textHeight());
@ -275,15 +274,9 @@ QPainterPath UBGraphicsTextItem::shape() const
void UBGraphicsTextItem::setTextWidth(qreal width)
{
QFontMetrics fm(font());
qreal strictMin = fm.height();
qreal strictMin = 155; // the size of the font customization panel
qreal newWidth = qMax(strictMin, width);
if (toPlainText().isEmpty())
{
qreal minWidth = fm.width(mTypeTextHereLabel);
newWidth = qMax(minWidth, newWidth);
}
QGraphicsTextItem::setTextWidth(newWidth);
}
@ -313,7 +306,7 @@ void UBGraphicsTextItem::contentsChanged()
if (toPlainText().isEmpty())
{
setTextWidth(textWidth());
resize(textWidth(),textHeight());
}
}

@ -52,6 +52,7 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra
, mNbColumns(1)
, mThumbnailWidth(0)
, mThumbnailMinWidth(100)
, mSelectedThumbnail(NULL)
{
setObjectName(name);
mScene = new QGraphicsScene(this);
@ -123,6 +124,7 @@ void UBDocumentNavigator::onScrollToSelectedPage(int index)
if (c==index)
{
el.getThumbnail()->setSelected(true);
mSelectedThumbnail = el.getThumbnail();
}
else
{
@ -130,6 +132,7 @@ void UBDocumentNavigator::onScrollToSelectedPage(int index)
}
c++;
}
centerOn(mSelectedThumbnail);
}
/**
@ -228,6 +231,9 @@ void UBDocumentNavigator::resizeEvent(QResizeEvent *event)
// Update the thumbnails width
mThumbnailWidth = (width() > mThumbnailMinWidth) ? width() - 2*border() : mThumbnailMinWidth;
if(mSelectedThumbnail)
centerOn(mSelectedThumbnail);
// Refresh the scene
refreshScene();
}

@ -59,7 +59,7 @@ protected:
virtual void mouseReleaseEvent(QMouseEvent *event);
private:
void refreshScene();
int border();
@ -76,6 +76,8 @@ private:
int mThumbnailWidth;
/** The current thumbnails minimum width */
int mThumbnailMinWidth;
/** The selected thumbnail */
UBSceneThumbnailNavigPixmap* mSelectedThumbnail;
};
#endif // UBDOCUMENTNAVIGATOR_H

Loading…
Cancel
Save