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

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

Loading…
Cancel
Save