wip
This commit is contained in:
parent
4d7db7c479
commit
2a6d27d78d
@ -57,22 +57,16 @@ namespace
|
||||
private:
|
||||
void openMenu()
|
||||
{
|
||||
auto pos = geometry().bottomLeft();
|
||||
auto menu = new QskMenu( window()->contentItem() );
|
||||
|
||||
QskMenu menu( window()->contentItem() );
|
||||
menu.setPopupFlag( QskPopup::DeleteOnClose, false );
|
||||
menu->addOption( "image://shapes/Rectangle/White", "Print" );
|
||||
menu->addOption( "image://shapes/Diamond/Yellow", "Save As" );
|
||||
menu->addOption( "image://shapes/Ellipse/Red", "Setup" );
|
||||
menu->addSeparator();
|
||||
menu->addOption( "image://shapes/Hexagon/PapayaWhip", "Help" );
|
||||
|
||||
menu.addOption( "image://shapes/Rectangle/White", "Print" );
|
||||
menu.addOption( "image://shapes/Diamond/Yellow", "Save As" );
|
||||
menu.addOption( "image://shapes/Ellipse/Red", "Setup" );
|
||||
menu.addSeparator();
|
||||
menu.addOption( "image://shapes/Hexagon/PapayaWhip", "Help" );
|
||||
|
||||
menu.setOrigin( pos );
|
||||
|
||||
const int result = menu.exec();
|
||||
if ( result >= 0 )
|
||||
qDebug() << "Selected:" << result;
|
||||
menu->setOrigin( geometry().bottomLeft() );
|
||||
menu->open();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskInputPanelBox.h>
|
||||
#include <QskListView.h>
|
||||
#include <QskMenu.h>
|
||||
#include <QskPageIndicator.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskProgressBar.h>
|
||||
@ -120,6 +121,7 @@ namespace
|
||||
void setupInputPanel();
|
||||
void setupVirtualKeyboard();
|
||||
void setupListView();
|
||||
void setupMenu();
|
||||
void setupPageIndicator();
|
||||
void setupPopup();
|
||||
void setupProgressBar();
|
||||
@ -151,6 +153,7 @@ void Editor::setup()
|
||||
setupInputPanel();
|
||||
setupVirtualKeyboard();
|
||||
setupListView();
|
||||
setupMenu();
|
||||
setupPageIndicator();
|
||||
setupPopup();
|
||||
setupProgressBar();
|
||||
@ -223,6 +226,45 @@ void Editor::setupPopup()
|
||||
setGradient( Q::Overlay, gradient );
|
||||
}
|
||||
|
||||
void Editor::setupMenu()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskMenu;
|
||||
|
||||
setBoxShape( Q::Panel, qskDpiScaled( 4 ) );
|
||||
setBoxBorderMetrics( Q::Panel, qskDpiScaled( 1 ) );
|
||||
setBoxBorderColors( Q::Panel, m_pal.darker125 );
|
||||
|
||||
setGradient( Q::Panel, m_pal.baseColor );
|
||||
|
||||
const bool isCascading = qskMaybeDesktopPlatform();
|
||||
setFlagHint( Q::Panel | A::Style, isCascading );
|
||||
|
||||
#if 0
|
||||
setPadding( Q::Separator, QMarginsF( 10, 0, 10, 0 ) );
|
||||
#endif
|
||||
setMetric( Q::Separator | A::Size, qskDpiScaled( 1 ) );
|
||||
setBoxShape( Q::Separator, 0 );
|
||||
setBoxBorderMetrics( Q::Separator, 0 );
|
||||
setGradient( Q::Separator, m_pal.darker125 );
|
||||
|
||||
setPadding( Q::Cell, QskMargins( 2, 10, 2, 10 ) );
|
||||
setSpacing( Q::Cell, 5 );
|
||||
setGradient( Q::Cell, Qt::transparent );
|
||||
|
||||
setGradient( Q::Cursor, m_pal.accentColor );
|
||||
|
||||
setColor( Q::Text, m_pal.textColor );
|
||||
setColor( Q::Text | Q::Selected, m_pal.contrastColor );
|
||||
setFontRole( Q::Text, QskSkin::SmallFont );
|
||||
|
||||
setPosition( Q::Panel, 0 );
|
||||
setPosition( Q::Panel | QskPopup::Closed, 1 );
|
||||
|
||||
setAnimation( Q::Panel | A::Metric, 150 );
|
||||
setAnimation( Q::Cursor | A::Position | A::Metric, 75, QEasingCurve::OutCubic );
|
||||
}
|
||||
|
||||
void Editor::setupTextLabel()
|
||||
{
|
||||
using Q = QskTextLabel;
|
||||
|
@ -331,11 +331,11 @@ void Editor::setupMenu()
|
||||
using A = QskAspect;
|
||||
using Q = QskMenu;
|
||||
|
||||
const QColor c1( 78, 158, 38 );
|
||||
const QColor c2( 15, 103, 43 );
|
||||
setBoxShape( Q::Panel, qskDpiScaled( 4 ) );
|
||||
setBoxBorderMetrics( Q::Panel, qskDpiScaled( 1 ) );
|
||||
setBoxBorderColors( Q::Panel, m_pal.darker125 );
|
||||
|
||||
setBoxShape( Q::Panel, 4 );
|
||||
setVGradient( Q::Panel, c1, c2 );
|
||||
setGradient( Q::Panel, m_pal.lighter110 );
|
||||
|
||||
const bool isCascading = qskMaybeDesktopPlatform();
|
||||
setFlagHint( Q::Panel | A::Style, isCascading );
|
||||
@ -343,16 +343,17 @@ void Editor::setupMenu()
|
||||
#if 0
|
||||
setPadding( Q::Separator, QMarginsF( 10, 0, 10, 0 ) );
|
||||
#endif
|
||||
setMetric( Q::Separator | A::Size, 2 );
|
||||
setMetric( Q::Separator | A::Size, qskDpiScaled( 2 ) );
|
||||
setSeparator( Q::Separator | A::Horizontal );
|
||||
|
||||
setPadding( Q::Cell, QskMargins( 2, 10, 2, 10 ) );
|
||||
setSpacing( Q::Cell, 5 );
|
||||
setGradient( Q::Cell, Qt::transparent );
|
||||
|
||||
setHGradient( Q::Cursor, c2, c2.lighter( 2 ) );
|
||||
setGradient( Q::Cursor, m_pal.highlighted );
|
||||
|
||||
setColor( Q::Text, QColor( 255, 255, 255 ) );
|
||||
setColor( Q::Text, m_pal.contrastedText );
|
||||
setColor( Q::Text | Q::Selected, m_pal.highlightedText );
|
||||
setFontRole( Q::Text, QskSkin::SmallFont );
|
||||
|
||||
setPosition( Q::Panel, 0 );
|
||||
|
@ -37,6 +37,11 @@ namespace
|
||||
QString text;
|
||||
|
||||
QskGraphic graphic;
|
||||
|
||||
#if 0
|
||||
// TODO ...
|
||||
bool isEnabled = true;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user