added slider size and position updating

preferencesAboutTextFull
Anna Udovichenko 13 years ago
parent 254d1acc9d
commit 0bed9fad8e
  1. 22
      src/gui/UBFeaturesWidget.cpp
  2. 2
      src/gui/UBFeaturesWidget.h

@ -70,6 +70,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
pathListView->setSelectionMode( QAbstractItemView::NoSelection ); pathListView->setSelectionMode( QAbstractItemView::NoSelection );
pathListView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); pathListView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
pathListView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); pathListView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
//pathListView->setResizeMode( QListView::Adjust );
//pathListView->setMovement( QListView::Static ); //pathListView->setMovement( QListView::Static );
pathListView->setDragDropMode( QAbstractItemView::DragDrop ); pathListView->setDragDropMode( QAbstractItemView::DragDrop );
@ -89,11 +90,16 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
currentStackedWidget = ID_LISTVIEW; currentStackedWidget = ID_LISTVIEW;
mActionBar = new UBFeaturesActionBar(controller, this); mActionBar = new UBFeaturesActionBar(controller, this);
thumbSlider = new QSlider( Qt::Horizontal, this ); thumbSlider = new QSlider( Qt::Horizontal, featuresListView );
thumbSlider->setMinimum( minThumbnailSize ); thumbSlider->setMinimum( minThumbnailSize );
thumbSlider->setMaximum( maxThumbnailSize ); thumbSlider->setMaximum( maxThumbnailSize );
thumbSlider->setValue( defaultThumbnailSize ); thumbSlider->setValue( defaultThumbnailSize );
layout->addWidget( thumbSlider ); //qDebug() << "init" << featuresListView->height();
thumbSlider->move( 0, featuresListView->height() );
thumbSlider->resize( thumbSlider->width(), thumbSlider->height() + 4 );
thumbSlider->show();
featuresListView->installEventFilter(this);
//layout->addWidget( thumbSlider );
layout->addWidget( mActionBar ); layout->addWidget( mActionBar );
/*connect(featuresListView->selectionModel(), SIGNAL(currentChanged ( const QModelIndex &, const QModelIndex & )), /*connect(featuresListView->selectionModel(), SIGNAL(currentChanged ( const QModelIndex &, const QModelIndex & )),
@ -110,6 +116,18 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
connect( thumbSlider, SIGNAL( sliderMoved(int) ), this, SLOT(thumbnailSizeChanged( int ) ) ); connect( thumbSlider, SIGNAL( sliderMoved(int) ), this, SLOT(thumbnailSizeChanged( int ) ) );
} }
bool UBFeaturesWidget::eventFilter( QObject *target, QEvent *event )
{
if ( target == featuresListView && event->type() == QEvent::Resize )
{
thumbSlider->move( 10, featuresListView->height() - thumbSlider->height() - 10 );
thumbSlider->resize( featuresListView->width() - 20, thumbSlider->height() );
//qDebug() << featuresListView->height();
//return true;
}
return UBDockPaletteWidget::eventFilter(target, event);
}
void UBFeaturesWidget::searchStarted( const QString &pattern ) void UBFeaturesWidget::searchStarted( const QString &pattern )
{ {
if ( pattern.isEmpty() ) if ( pattern.isEmpty() )

@ -92,6 +92,8 @@ private slots:
void addToFavorite( const QMimeData & ); void addToFavorite( const QMimeData & );
void removeFromFavorite( const QMimeData & ); void removeFromFavorite( const QMimeData & );
void thumbnailSizeChanged( int ); void thumbnailSizeChanged( int );
protected:
bool eventFilter(QObject *target, QEvent *event);
}; };
class UBFeaturesListView : public QListView class UBFeaturesListView : public QListView

Loading…
Cancel
Save