KNMouseSenseWidget::KNMouseSenseWidget(QWidget *parent) : QWidget(parent) { //Set properties. setAutoFillBackground(true); //Initial the background color and mouse timeline. m_backgroundColor.setHsv(m_backgroundColor.hue(), m_backgroundColor.saturation(), m_outBrightness); m_palette=palette(); m_palette.setColor(QPalette::Base, QColor(0,0,0,0)); m_palette.setColor(QPalette::Window, m_backgroundColor); m_palette.setColor(QPalette::Button, QColor(0x30, 0x30, 0x30)); m_palette.setColor(QPalette::Text, QColor(0x8f, 0x8f, 0x8f, 0xaf)); m_palette.setColor(QPalette::Highlight, QColor(0x60, 0x60, 0x60)); m_palette.setColor(QPalette::HighlightedText, QColor(0xf7, 0xcf, 0x3d)); setPalette(m_palette); m_mouseIn=new QTimeLine(200, this); m_mouseIn->setEndFrame(m_inBrightness); configureTimeLine(m_mouseIn); m_mouseOut=new QTimeLine(200, this); m_mouseOut->setEndFrame(m_outBrightness); configureTimeLine(m_mouseOut); }
KNCategoryTabBar::KNCategoryTabBar(QWidget *parent) : QWidget(parent) { //Set properties. setAutoFillBackground(true); setContentsMargins(0,0,0,0); //Hight should be the same as the button. setFixedHeight(KNCategoryButton::buttonHeight()); //Initial the color. m_backgroundColor.setHsv(m_backgroundColor.hue(), m_backgroundColor.saturation(), m_outBridhtness); m_palette=palette(); m_palette.setColor(QPalette::Window, m_backgroundColor); setPalette(m_palette); //Initial the layout. m_tabLayout=new QBoxLayout(QBoxLayout::LeftToRight, this); m_tabLayout->setContentsMargins(0,0,0,0); m_tabLayout->setSpacing(0); setLayout(m_tabLayout); //Initial the signal mapper. m_buttonMapper=new QSignalMapper(this); connect(m_buttonMapper, SIGNAL(mapped(int)), this, SLOT(setCurrentIndex(int))); //Initial the mouse in/out timeline. m_mouseIn=new QTimeLine(200, this); m_mouseIn->setEndFrame(m_inBridhtness); configureTimeLine(m_mouseIn); m_mouseOut=new QTimeLine(200, this); m_mouseOut->setEndFrame(m_outBridhtness); configureTimeLine(m_mouseOut); }
KNMusicTreeViewBase::KNMusicTreeViewBase(QWidget *parent) : QTreeView(parent) { //Set properties. setAllColumnsShowFocus(true); setAlternatingRowColors(true); setContentsMargins(0,0,0,0); setDragDropMode(QAbstractItemView::DragOnly); setDropIndicatorShown(true); setFrameShape(QFrame::NoFrame); setIndentation(0); setMouseTracking(true); setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::ExtendedSelection); setUniformRowHeights(true); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); //Set scroll bar properties. horizontalScrollBar()->setSingleStep(5); horizontalScrollBar()->setPageStep(5); verticalScrollBar()->setSingleStep(4); verticalScrollBar()->setPageStep(4); //Using frame updater to set palette. onActionMouseInOut(0); //Set animation header. KNMusicTreeViewHeader *header=new KNMusicTreeViewHeader(this); connect(header, &KNMusicTreeViewHeader::requireResizeColumnToContents, this, &KNMusicTreeViewBase::resizeColumnToContents); setHeader(header); //Set delegate. setItemDelegateForColumn(Rating, new KNMusicRatingDelegate(this)); setItemDelegateForColumn(AlbumRating, new KNMusicRatingDelegate(this)); //Initial menu connections. m_soloConnections=new KNConnectionHandler(this); m_multiConnections=new KNConnectionHandler(this); //Initial mouse sense animation. m_mouseIn=new QTimeLine(200, this); configureTimeLine(m_mouseIn); m_mouseIn->setEndFrame(m_maxOpacity); m_mouseOut=new QTimeLine(200, this); configureTimeLine(m_mouseOut); m_mouseOut->setEndFrame(0); //Initial reacts. connect(this, &KNMusicTreeViewBase::activated, this, &KNMusicTreeViewBase::playIndex); //Initial actions. initialActions(); }
KNProgressSlider::KNProgressSlider(QWidget *parent) : KNAbstractSlider(parent) { //Initial the mouse sense timeline. m_mouseIn=new QTimeLine(200, this); m_mouseIn->setEndFrame(100); configureTimeLine(m_mouseIn); m_mouseOut=new QTimeLine(200, this); m_mouseOut->setEndFrame(m_mouseOutOpacity*100); configureTimeLine(m_mouseOut); //Set properties. setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, QSizePolicy::Slider)); updateButtonSize(); }