centered left panel on selected thumbnail

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent 8148ac7619
commit 1423fb937a
  1. 6
      src/gui/UBDocumentNavigator.cpp
  2. 6
      src/gui/UBDocumentNavigator.h

@ -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