diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 5a00d0a7..a9951719 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -6,7 +6,6 @@ add_subdirectory(desktop) add_subdirectory(gallery) add_subdirectory(layouts) -add_subdirectory(messagebox) add_subdirectory(mycontrols) add_subdirectory(qvgviewer) add_subdirectory(thumbnails) @@ -18,5 +17,4 @@ if( BUILD_QML_EXPORT ) add_subdirectory(buttons) add_subdirectory(frames) add_subdirectory(glabels) - add_subdirectory(messageboxQml) endif() diff --git a/examples/gallery/dialog/DialogPage.cpp b/examples/gallery/dialog/DialogPage.cpp index bc77a02a..0e9e7946 100644 --- a/examples/gallery/dialog/DialogPage.cpp +++ b/examples/gallery/dialog/DialogPage.cpp @@ -15,80 +15,106 @@ namespace { class Button : public QskPushButton { - Q_OBJECT - public: - enum ButtonType + Button( const QString& text, QQuickItem* parent = nullptr ) + : QskPushButton( text, parent ) { - Message, - Information, - Warning, - Critical, + } + }; - Question, - Selection, - - TypeCount - }; - Q_ENUM( ButtonType ) - - Button( ButtonType type, QQuickItem* parent = nullptr ) - : QskPushButton( parent ) - , m_type( type ) + class ButtonBox : public QskLinearBox + { + public: + ButtonBox( QQuickItem* parent = nullptr ) + : QskLinearBox( Qt::Horizontal, 2, parent ) { - setShape( 10 ); - initSizePolicy( QskSizePolicy::Preferred, QskSizePolicy::Fixed ); + setObjectName( "ButtonBox" ); - const int index = metaObject()->indexOfEnumerator( "ButtonType" ); - setText( metaObject()->enumerator( index ).key( m_type ) ); + setMargins( 10 ); + setSpacing( 20 ); - connect( this, &QskPushButton::clicked, this, &Button::showDialog ); + auto messageButton = new Button( "Message", this ); + connect( messageButton, &Button::clicked, this, &ButtonBox::execMessage ); + + auto informationButton = new Button( "Information", this ); + connect( informationButton, &Button::clicked, this, &ButtonBox::execInformation ); + + auto questionButton = new Button( "Question", this ); + connect( questionButton, &Button::clicked, this, &ButtonBox::execQuestion ); + + auto warningButton = new Button( "Warning", this ); + connect( warningButton, &Button::clicked, this, &ButtonBox::execWarning ); + + auto criticalButton = new Button( "Critical", this ); + connect( criticalButton, &Button::clicked, this, &ButtonBox::execCritical ); + + auto selectButton = new Button( "Selection", this ); + connect( selectButton, &Button::clicked, this, &ButtonBox::execSelection ); + + setExtraSpacingAt( Qt::BottomEdge ); } private: - void showDialog() + void execMessage() { - switch( static_cast< int >( m_type ) ) - { - case Message: - qskDialog->message( text(), text(), QskStandardSymbol::Ok ); - break; - - case Information: - qskDialog->information( text(), text() ); - break; - - case Warning: - qskDialog->warning( text(), text() ); - break; - - case Critical: - qskDialog->critical( text(), text() ); - break; - - case Question: - qskDialog->question( text(), text() ); - break; - - case Selection: - qskDialog->select( text(), text(), { "yes", "no", "maybe" } ); - break; - } + qskDialog->message( "Message", "Request vector, over.", + QskStandardSymbol::NoSymbol, QskDialog::Close ); } - const ButtonType m_type; + void execInformation() + { + qskDialog->information( "Information", + "We have clearance, Clarence." ); + } + + void execQuestion() + { + qskDialog->question( "Question", + "Roger, Roger. Do we have a vector, Victor ?" ); + } + + void execWarning() + { + qskDialog->warning( "Warning", "We have clearance, Clarence." ); + } + + void execCritical() + { + qskDialog->critical( "Critical", "That's Clarence Oveur. Over." ); + } + + void execSelection() + { + // of course we all love "The Teens" + const QStringList entries = + { + "Give Me More", + "Gimme Gimme Your Love", + "1-2-3-4 Red Light", + "New York", + "If You Walk Away", + "Eloise", + "On The Radio", + "We Are The Teens", + "Never Gonna Tell No Lie To You", + "Walking On Sunshine ", + "Get Out Of My Mind", + "Cover Girl ", + "Here I Stand", + "Gypsy Caravan", + "It´s Good To Have A Friend", + "We´ll Have A Party Tonite ´nite", + "Automatic World", + "Gimme Gimme Gimme Gimme Gimme Your Love" + }; + + qskDialog->select( "Here we go ...", "Hot Hot Hot", entries, 7 ); + } }; } DialogPage::DialogPage( QQuickItem* parent ) : Page( Qt::Horizontal, parent ) { - auto box = new QskLinearBox( Qt::Horizontal, 2, this ); - box->setSpacing( 20 ); - box->setExtraSpacingAt( Qt::BottomEdge ); - - for ( int i = 0; i < Button::TypeCount; i++ ) - new Button( static_cast< Button::ButtonType >( i ), box ); + ( void ) new ButtonBox( this ); } - -#include "DialogPage.moc" diff --git a/examples/messagebox/CMakeLists.txt b/examples/messagebox/CMakeLists.txt deleted file mode 100644 index 525b4612..00000000 --- a/examples/messagebox/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -############################################################################ -# QSkinny - Copyright (C) 2016 Uwe Rathmann -# SPDX-License-Identifier: BSD-3-Clause -############################################################################ - -qsk_add_example(messagebox main.cpp) diff --git a/examples/messagebox/main.cpp b/examples/messagebox/main.cpp deleted file mode 100644 index 360995ae..00000000 --- a/examples/messagebox/main.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) 2016 Uwe Rathmann - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -class Button : public QskPushButton -{ - public: - Button( const QString& text, QQuickItem* parent = nullptr ) - : QskPushButton( text, parent ) - { - setObjectName( text ); - setSizePolicy( QskSizePolicy::MinimumExpanding, - QskSizePolicy::MinimumExpanding ); - } -}; - -class ButtonBox : public QskLinearBox -{ - public: - ButtonBox( QQuickItem* parent = nullptr ) - : QskLinearBox( Qt::Horizontal, 2, parent ) - { - setObjectName( "ButtonBox" ); - - setMargins( 10 ); - setSpacing( 5 ); - - Button* messageButton = new Button( "Message", this ); - connect( messageButton, &Button::clicked, this, &ButtonBox::execMessage ); - - Button* informationButton = new Button( "Information", this ); - connect( informationButton, &Button::clicked, this, &ButtonBox::execInformation ); - - Button* questionButton = new Button( "Question", this ); - connect( questionButton, &Button::clicked, this, &ButtonBox::execQuestion ); - - Button* warningButton = new Button( "Warning", this ); - connect( warningButton, &Button::clicked, this, &ButtonBox::execWarning ); - - Button* criticalButton = new Button( "Critical", this ); - connect( criticalButton, &Button::clicked, this, &ButtonBox::execCritical ); - - Button* selectButton = new Button( "Selection", this ); - connect( selectButton, &Button::clicked, this, &ButtonBox::execSelection ); - } - - private: - void execMessage() - { - qDebug() << qskDialog->message( "Message", "Request vector, over.", - QskStandardSymbol::NoSymbol, QskDialog::Close ); - } - - void execInformation() - { - qDebug() << qskDialog->information( "Information", - "We have clearance, Clarence." ); - } - - void execQuestion() - { - qDebug() << qskDialog->question( "Question", - "Roger, Roger. Do we have a vector, Victor ?" ); - } - - void execWarning() - { - qDebug() << qskDialog->warning( "Warning", "We have clearance, Clarence." ); - } - - void execCritical() - { - qDebug() << qskDialog->critical( "Critical", "That's Clarence Oveur. Over." ); - } - - void execSelection() - { - // of course we all love "The Teens" - const QStringList entries = - { - "Give Me More", - "Gimme Gimme Your Love", - "1-2-3-4 Red Light", - "New York", - "If You Walk Away", - "Eloise", - "On The Radio", - "We Are The Teens", - "Never Gonna Tell No Lie To You", - "Walking On Sunshine ", - "Get Out Of My Mind", - "Cover Girl ", - "Here I Stand", - "Gypsy Caravan", - "It´s Good To Have A Friend", - "We´ll Have A Party Tonite ´nite", - "Automatic World", - "Gimme Gimme Gimme Gimme Gimme Your Love" - }; - - qDebug() << qskDialog->select( "Here we go ...", "Hot Hot Hot", entries, 7 ); - } -}; - -int main( int argc, char* argv[] ) -{ -#ifdef ITEM_STATISTICS - QskObjectCounter counter( true ); -#endif - - QGuiApplication app( argc, argv ); - - SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts ); - - qskDialog->setPolicy( QskDialog::EmbeddedBox ); - - auto box = new ButtonBox(); - - /* - To avoid losing the focus, when a message box is executed - we have to define the "main window" ( here a ButtonBox ) to - be a focusScope. - */ - box->setFlag( QQuickItem::ItemIsFocusScope, true ); - box->setTabFence( true ); - box->setFocusPolicy( Qt::TabFocus ); - - // setting the initial focus - box->itemAtIndex( 0 )->setFocus( true ); - box->setFocus( true ); - - QskWindow window; - window.addItem( box ); - window.addItem( new QskFocusIndicator() ); - - window.resize( 800, 800 ); - window.show(); - - return app.exec(); -} diff --git a/examples/messageboxQml/CMakeLists.txt b/examples/messageboxQml/CMakeLists.txt deleted file mode 100644 index db3c2999..00000000 --- a/examples/messageboxQml/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -############################################################################ -# QSkinny - Copyright (C) 2016 Uwe Rathmann -# SPDX-License-Identifier: BSD-3-Clause -############################################################################ - -set(SOURCES main.cpp) -qt_add_resources(SOURCES messagebox.qrc) - -qsk_add_example(messageboxQml ${SOURCES}) diff --git a/examples/messageboxQml/main.cpp b/examples/messageboxQml/main.cpp deleted file mode 100644 index f103efed..00000000 --- a/examples/messageboxQml/main.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) 2016 Uwe Rathmann - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#include - -#include -#include - -#include -#include - -int main( int argc, char* argv[] ) -{ -#ifdef ITEM_STATISTICS - QskObjectCounter counter( true ); -#endif - - QskQml::registerTypes(); - - QGuiApplication app( argc, argv ); - - SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts ); - - QQmlApplicationEngine engine( QUrl( "qrc:/qml/messagebox.qml" ) ); - - return app.exec(); -} diff --git a/examples/messageboxQml/messagebox.qml b/examples/messageboxQml/messagebox.qml deleted file mode 100644 index 6be1eccc..00000000 --- a/examples/messageboxQml/messagebox.qml +++ /dev/null @@ -1,147 +0,0 @@ -import QtQuick 2.0 -import Skinny 1.0 as Qsk -import "qrc:/qml" - -Qsk.Window -{ - id: window - - visible: true - width: 600 - height: 400 - // color: "Beige" - - Qsk.LinearBox - { - orientation: Qt.Horizontal - dimension: 2 - - margins { left: 10; top: 10; right: 10; bottom: 10 } - //margins: 10 - - Qsk.PushButton - { - id: messageButton - text: "Message" - - focus: true - - sizePolicy.vertical: Qsk.SizePolicy.MinimumExpanding - - onClicked: - { - var answer = Qsk.Dialog.message( - "Message", "Request vector, over.", - Qsk.StandardSymbol.NoSymbol, Qsk.Dialog.Close - ); - } - } - - Qsk.PushButton - { - id: informationButton - text: "Information" - - sizePolicy.vertical: Qsk.SizePolicy.MinimumExpanding - - onClicked: - { - var answer = Qsk.Dialog.information( - "Information", "We have clearance, Clarence." - ); - } - } - - Qsk.PushButton - { - id: questionButton - text: "Question" - - sizePolicy.vertical: Qsk.SizePolicy.MinimumExpanding - - onClicked: - { - var answer = Qsk.Dialog.question( - "Question", "Roger, Roger. Do we have a vector, Victor ?", - Qsk.Dialog.Yes | Qsk.Dialog.No - ) - - if ( answer == Qsk.Dialog.Yes ) - console.log( "Yes" ) - else - console.log( "No" ) - } - } - - Qsk.PushButton - { - id: warningButton - text: "Warning" - - sizePolicy.vertical: Qsk.SizePolicy.MinimumExpanding - - onClicked: - { - var answer = Qsk.Dialog.warning( - "Warning", "We have clearance, Clarence." - ) - } - } - - Qsk.PushButton - { - id: criticalButton - text: "Critical" - - sizePolicy.vertical: Qsk.SizePolicy.MinimumExpanding - - onClicked: - { - var answer = Qsk.Dialog.critical( - "Critical", "That's Clarence Oveur. Over." - ); - } - } - - Qsk.PushButton - { - id: selectionButton - text: "Selection" - - sizePolicy.vertical: Qsk.SizePolicy.MinimumExpanding - - onClicked: - { - var hotTracks = [ - "Give Me More", - "Gimme Gimme Your Love", - "1-2-3-4 Red Light", - "New York", - "If You Walk Away", - "Eloise", - "On The Radio", - "We Are The Teens", - "Never Gonna Tell No Lie To You", - "Walking On Sunshine ", - "Get Out Of My Mind", - "Cover Girl ", - "Here I Stand", - "Gypsy Caravan", - "It´s Good To Have A Friend", - "We´ll Have A Party Tonite ´nite", - "Automatic World", - "Gimme Gimme Gimme Gimme Gimme Your Love" - ] - - var hottestTrackEver = Qsk.Dialog.select( - "Here we go ...", "Hot Hot Hot", hotTracks, 7 ) - - console.log( hottestTrackEver ) - } - } - } - - Qsk.FocusIndicator - { - } -} diff --git a/examples/messageboxQml/messagebox.qrc b/examples/messageboxQml/messagebox.qrc deleted file mode 100644 index 5816580f..00000000 --- a/examples/messageboxQml/messagebox.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - messagebox.qml - -