Commit 31e06602 authored by Bryan Gardiner's avatar Bryan Gardiner

Merge Qt graphics view support (MR !1, issue #16).

parents 7c96f9a6 f022a603
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
/qtah/src/Graphics/UI/Qtah/Gui/Q* /qtah/src/Graphics/UI/Qtah/Gui/Q*
/qtah/src/Graphics/UI/Qtah/Internal/Callback.hs /qtah/src/Graphics/UI/Qtah/Internal/Callback.hs
/qtah/src/Graphics/UI/Qtah/Internal/EventListener.hs /qtah/src/Graphics/UI/Qtah/Internal/EventListener.hs
/qtah/src/Graphics/UI/Qtah/Internal/SceneEventListener.hs
/qtah/src/Graphics/UI/Qtah/Internal/Listener.hs /qtah/src/Graphics/UI/Qtah/Internal/Listener.hs
/qtah/src/Graphics/UI/Qtah/Std.hs /qtah/src/Graphics/UI/Qtah/Std.hs
/qtah/src/Graphics/UI/Qtah/Widgets/Q* /qtah/src/Graphics/UI/Qtah/Widgets/Q*
...@@ -56,6 +57,11 @@ ...@@ -56,6 +57,11 @@
/qtah-qt?/src/Graphics/UI/Qtah/Gui/Q* /qtah-qt?/src/Graphics/UI/Qtah/Gui/Q*
/qtah-qt?/src/Graphics/UI/Qtah/Internal/Callback.hs /qtah-qt?/src/Graphics/UI/Qtah/Internal/Callback.hs
/qtah-qt?/src/Graphics/UI/Qtah/Internal/EventListener.hs /qtah-qt?/src/Graphics/UI/Qtah/Internal/EventListener.hs
/qtah-qt?/src/Graphics/UI/Qtah/Internal/SceneEventListener.hs
/qtah-qt?/src/Graphics/UI/Qtah/Internal/Listener.hs /qtah-qt?/src/Graphics/UI/Qtah/Internal/Listener.hs
/qtah-qt?/src/Graphics/UI/Qtah/Std.hs /qtah-qt?/src/Graphics/UI/Qtah/Std.hs
/qtah-qt?/src/Graphics/UI/Qtah/Widgets/Q* /qtah-qt?/src/Graphics/UI/Qtah/Widgets/Q*
*~
.stack-work
...@@ -59,15 +59,14 @@ the version of Qt that Qtah is built against, you must first clean the existing ...@@ -59,15 +59,14 @@ the version of Qt that Qtah is built against, you must first clean the existing
build outputs (`clean.sh`) before running the build script again. build outputs (`clean.sh`) before running the build script again.
Packages that use Qtah should only depend on a `qtah-qtX` package (or just Packages that use Qtah should only depend on a `qtah-qtX` package (or just
`qtah` if building locally). Executables that use Qtah should be linked `qtah` if building locally). Executables that use Qtah need to be linked
dynamically, by passing the `--enable-executable-dynamic` flag to `cabal dynamically, so put `ghc-options: -dynamic` in your Cabal file. This includes
configure` or `cabal install`. This includes unit tests. unit tests.
There is a demo program in `/qtah-examples` that can be built and run after There is a demo program in `/qtah-examples` that can be built and run after
installing Qtah: installing Qtah:
$ cd qtah-examples $ cd qtah-examples
$ cabal configure --enable-executable-dynamic
$ cabal run $ cabal run
### Dependencies ### Dependencies
......
...@@ -84,8 +84,7 @@ sdist ...@@ -84,8 +84,7 @@ sdist
echo echo
msg "Building and installing qtah." msg "Building and installing qtah."
goToPkg qtah goToPkg qtah
run cabal configure ${QTAH_QT_FLAGS:+--flags="$QTAH_QT_FLAGS"} \ run cabal configure ${QTAH_QT_FLAGS:+--flags="$QTAH_QT_FLAGS"} --enable-tests
--enable-tests --enable-executable-dynamic
run cabal build ${QTAH_BUILD_JOBS:+--jobs="$QTAH_BUILD_JOBS"} run cabal build ${QTAH_BUILD_JOBS:+--jobs="$QTAH_BUILD_JOBS"}
# We call the test executable directly instead of running 'cabal test', for # We call the test executable directly instead of running 'cabal test', for
# distros such as Debian Stretch that are affected by # distros such as Debian Stretch that are affected by
...@@ -98,14 +97,14 @@ run cabal test ...@@ -98,14 +97,14 @@ run cabal test
# silence them. # silence them.
run cabal haddock --haddock-options=--no-print-missing-docs run cabal haddock --haddock-options=--no-print-missing-docs
run cabal install ${QTAH_QT_FLAGS:+--flags="$QTAH_QT_FLAGS"} \ run cabal install ${QTAH_QT_FLAGS:+--flags="$QTAH_QT_FLAGS"} \
--enable-tests --enable-executable-dynamic --force-reinstalls --enable-tests --force-reinstalls
sdist sdist
if [[ $commands = *\ examples\ * ]] || [[ $commands = *\ sdist\ * ]]; then if [[ $commands = *\ examples\ * ]] || [[ $commands = *\ sdist\ * ]]; then
echo echo
msg "Building qtah-examples." msg "Building qtah-examples."
goToPkg qtah-examples goToPkg qtah-examples
run cabal configure --enable-executable-dynamic run cabal configure
run cabal build run cabal build
sdist sdist
fi fi
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QEvent> #include <QEvent>
#include <QGraphicsItem>
#include <QObject>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QWidget>
#include "b_callback.hpp" #include "b_callback.hpp"
namespace qtah { namespace qtah {
...@@ -60,6 +65,44 @@ private: ...@@ -60,6 +65,44 @@ private:
bool notifyDeleted_; bool notifyDeleted_;
}; };
class SceneEventListener : public QGraphicsItem {
public:
SceneEventListener(
QGraphicsItem *parent,
CallbackPtrQGraphicsItemPtrQEventBool eventCallback,
CallbackVoid deletedCallback) :
QGraphicsItem(parent),
eventCallback_(eventCallback),
deletedCallback_(deletedCallback),
notifyDeleted_(true) {
parent->installSceneEventFilter(this);
}
~SceneEventListener() {
parentItem()->removeSceneEventFilter(this);
if (notifyDeleted_) {
deletedCallback_();
}
}
virtual bool sceneEventFilter(QGraphicsItem* receiver, QEvent* event) {
return eventCallback_(receiver, event);
}
void doNotNotifyOnDelete() {
notifyDeleted_ = false;
}
virtual QRectF boundingRect() const { return QRectF(); }
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* = 0) { return; }
private:
CallbackPtrQGraphicsItemPtrQEventBool eventCallback_;
CallbackVoid deletedCallback_;
bool notifyDeleted_;
};
} // namespace event } // namespace event
} // namespace qtah } // namespace qtah
......
...@@ -15,25 +15,7 @@ ...@@ -15,25 +15,7 @@
-- You should have received a copy of the GNU Lesser General Public License -- You should have received a copy of the GNU Lesser General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
import Control.Monad (unless) import Distribution.Simple (defaultMain)
import Distribution.Simple (defaultMainWithHooks, simpleUserHooks)
import Distribution.Simple.Setup (ConfigFlags, configDynExe, configVerbosity, fromFlagOrDefault)
import Distribution.Simple.UserHooks (UserHooks (postConf))
import Distribution.Simple.Utils (warn)
import Distribution.Verbosity (normal)
main :: IO () main :: IO ()
main = defaultMainWithHooks qtahHooks main = defaultMain
qtahHooks :: UserHooks
qtahHooks = simpleUserHooks
{ postConf = \_ cf _ _ -> warnAboutDynExe cf
}
warnAboutDynExe :: ConfigFlags -> IO ()
warnAboutDynExe configFlags = do
let verbosity = fromFlagOrDefault normal $ configVerbosity configFlags
unless (fromFlagOrDefault False $ configDynExe configFlags) $
warn verbosity $
"qtah-examples needs to be a dynamically linked executable; " ++
"please pass --enable-executable-dynamic to 'cabal install'."
...@@ -26,5 +26,5 @@ executable qtah-examples ...@@ -26,5 +26,5 @@ executable qtah-examples
, filepath >=1.0 && <1.5 , filepath >=1.0 && <1.5
, hoppy-runtime >=0.3 && <0.4 , hoppy-runtime >=0.3 && <0.4
, qtah >=0.2 && <0.3 , qtah >=0.2 && <0.3
ghc-options: -W -fwarn-incomplete-patterns -fwarn-unused-do-bind ghc-options: -W -fwarn-incomplete-patterns -fwarn-unused-do-bind -dynamic
default-language: Haskell2010 default-language: Haskell2010
...@@ -76,12 +76,14 @@ executable qtah-generator ...@@ -76,12 +76,14 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Core.QString , Graphics.UI.Qtah.Generator.Interface.Core.QString
, Graphics.UI.Qtah.Generator.Interface.Core.QStringList , Graphics.UI.Qtah.Generator.Interface.Core.QStringList
, Graphics.UI.Qtah.Generator.Interface.Core.QStringListModel , Graphics.UI.Qtah.Generator.Interface.Core.QStringListModel
, Graphics.UI.Qtah.Generator.Interface.Core.QTimer
, Graphics.UI.Qtah.Generator.Interface.Core.QTimerEvent , Graphics.UI.Qtah.Generator.Interface.Core.QTimerEvent
, Graphics.UI.Qtah.Generator.Interface.Core.QVariant , Graphics.UI.Qtah.Generator.Interface.Core.QVariant
, Graphics.UI.Qtah.Generator.Interface.Core.QVector , Graphics.UI.Qtah.Generator.Interface.Core.QVector
, Graphics.UI.Qtah.Generator.Interface.Core.Types , Graphics.UI.Qtah.Generator.Interface.Core.Types
, Graphics.UI.Qtah.Generator.Interface.Gui , Graphics.UI.Qtah.Generator.Interface.Gui
, Graphics.UI.Qtah.Generator.Interface.Gui.QActionEvent , Graphics.UI.Qtah.Generator.Interface.Gui.QActionEvent
, Graphics.UI.Qtah.Generator.Interface.Gui.QBrush
, Graphics.UI.Qtah.Generator.Interface.Gui.QClipboard , Graphics.UI.Qtah.Generator.Interface.Gui.QClipboard
, Graphics.UI.Qtah.Generator.Interface.Gui.QCloseEvent , Graphics.UI.Qtah.Generator.Interface.Gui.QCloseEvent
, Graphics.UI.Qtah.Generator.Interface.Gui.QColor , Graphics.UI.Qtah.Generator.Interface.Gui.QColor
...@@ -95,10 +97,14 @@ executable qtah-generator ...@@ -95,10 +97,14 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Gui.QIntValidator , Graphics.UI.Qtah.Generator.Interface.Gui.QIntValidator
, Graphics.UI.Qtah.Generator.Interface.Gui.QKeyEvent , Graphics.UI.Qtah.Generator.Interface.Gui.QKeyEvent
, Graphics.UI.Qtah.Generator.Interface.Gui.QMouseEvent , Graphics.UI.Qtah.Generator.Interface.Gui.QMouseEvent
, Graphics.UI.Qtah.Generator.Interface.Gui.QPainter
, Graphics.UI.Qtah.Generator.Interface.Gui.QPainterPath
, Graphics.UI.Qtah.Generator.Interface.Gui.QPen
, Graphics.UI.Qtah.Generator.Interface.Gui.QPolygon , Graphics.UI.Qtah.Generator.Interface.Gui.QPolygon
, Graphics.UI.Qtah.Generator.Interface.Gui.QPolygonF , Graphics.UI.Qtah.Generator.Interface.Gui.QPolygonF
, Graphics.UI.Qtah.Generator.Interface.Gui.QRegion , Graphics.UI.Qtah.Generator.Interface.Gui.QRegion
, Graphics.UI.Qtah.Generator.Interface.Gui.QShowEvent , Graphics.UI.Qtah.Generator.Interface.Gui.QShowEvent
, Graphics.UI.Qtah.Generator.Interface.Gui.QTransform
, Graphics.UI.Qtah.Generator.Interface.Gui.QValidator , Graphics.UI.Qtah.Generator.Interface.Gui.QValidator
, Graphics.UI.Qtah.Generator.Interface.Gui.QWheelEvent , Graphics.UI.Qtah.Generator.Interface.Gui.QWheelEvent
, Graphics.UI.Qtah.Generator.Interface.Imports , Graphics.UI.Qtah.Generator.Interface.Imports
...@@ -106,8 +112,10 @@ executable qtah-generator ...@@ -106,8 +112,10 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Internal.Callback , Graphics.UI.Qtah.Generator.Interface.Internal.Callback
, Graphics.UI.Qtah.Generator.Interface.Internal.EventListener , Graphics.UI.Qtah.Generator.Interface.Internal.EventListener
, Graphics.UI.Qtah.Generator.Interface.Internal.Listener , Graphics.UI.Qtah.Generator.Interface.Internal.Listener
, Graphics.UI.Qtah.Generator.Interface.Internal.SceneEventListener
, Graphics.UI.Qtah.Generator.Interface.Widgets , Graphics.UI.Qtah.Generator.Interface.Widgets
, Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton , Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton
, Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractGraphicsShapeItem
, Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractScrollArea , Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractScrollArea
, Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSlider , Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSlider
, Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSpinBox , Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSpinBox
...@@ -124,6 +132,15 @@ executable qtah-generator ...@@ -124,6 +132,15 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Widgets.QFileDialog , Graphics.UI.Qtah.Generator.Interface.Widgets.QFileDialog
, Graphics.UI.Qtah.Generator.Interface.Widgets.QFormLayout , Graphics.UI.Qtah.Generator.Interface.Widgets.QFormLayout
, Graphics.UI.Qtah.Generator.Interface.Widgets.QFrame , Graphics.UI.Qtah.Generator.Interface.Widgets.QFrame
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsEllipseItem
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsItem
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsPolygonItem
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsRectItem
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsScene
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsSceneEvent
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsSceneMouseEvent
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsSceneWheelEvent
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsView
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGridLayout , Graphics.UI.Qtah.Generator.Interface.Widgets.QGridLayout
, Graphics.UI.Qtah.Generator.Interface.Widgets.QGroupBox , Graphics.UI.Qtah.Generator.Interface.Widgets.QGroupBox
, Graphics.UI.Qtah.Generator.Interface.Widgets.QHBoxLayout , Graphics.UI.Qtah.Generator.Interface.Widgets.QHBoxLayout
......
...@@ -39,6 +39,7 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Core.QSizeF as QSizeF ...@@ -39,6 +39,7 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Core.QSizeF as QSizeF
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QString as QString import qualified Graphics.UI.Qtah.Generator.Interface.Core.QString as QString
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QStringList as QStringList import qualified Graphics.UI.Qtah.Generator.Interface.Core.QStringList as QStringList
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QStringListModel as QStringListModel import qualified Graphics.UI.Qtah.Generator.Interface.Core.QStringListModel as QStringListModel
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QTimer as QTimer
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QTimerEvent as QTimerEvent import qualified Graphics.UI.Qtah.Generator.Interface.Core.QTimerEvent as QTimerEvent
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QVariant as QVariant import qualified Graphics.UI.Qtah.Generator.Interface.Core.QVariant as QVariant
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QVector as QVector import qualified Graphics.UI.Qtah.Generator.Interface.Core.QVector as QVector
...@@ -71,6 +72,7 @@ modules = ...@@ -71,6 +72,7 @@ modules =
, QString.aModule , QString.aModule
, QStringList.aModule , QStringList.aModule
, QStringListModel.aModule , QStringListModel.aModule
, QTimer.aModule
, QTimerEvent.aModule , QTimerEvent.aModule
, QVariant.aModule , QVariant.aModule
, Types.aModule , Types.aModule
......
...@@ -36,6 +36,7 @@ import Foreign.Hoppy.Generator.Types (boolT, intT, objT, ptrT, voidT) ...@@ -36,6 +36,7 @@ import Foreign.Hoppy.Generator.Types (boolT, intT, objT, ptrT, voidT)
import Foreign.Hoppy.Generator.Version (collect, just, test) import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Flags (qtVersion)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Internal.Listener import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Internal.Listener
(c_ListenerPtrQObject, c_ListenerQString)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QList (c_QListQObject) import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QList (c_QListQObject)
import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent)
import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)
......
-- This file is part of Qtah.
--
-- Copyright 2016-2017 Bryan Gardiner <bog@khumba.net>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module Graphics.UI.Qtah.Generator.Interface.Core.QTimer (
aModule,
c_QTimer
) where
import Foreign.Hoppy.Generator.Spec (
Export(ExportClass),
addReqIncludes,
classSetEntityPrefix,
ident,
includeStd,
makeClass,
mkMethod,
mkConstMethod,
mkCtor,
)
import Foreign.Hoppy.Generator.Types (boolT, intT, voidT)
import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Flags (qtVersion)
import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_Listener)
import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
import Graphics.UI.Qtah.Generator.Types
{-# ANN module "HLint: ignore Use camelCase" #-}
aModule =
AQtModule $
makeQtModule ["Core", "QTimer"]
[ QtExport $ ExportClass c_QTimer
, QtExportSignal s_timeout
]
c_QTimer =
addReqIncludes [includeStd "QTimer"] $
classSetEntityPrefix "" $
makeClass (ident "QTimer") Nothing [c_QObject] $
collect
[ just $ mkCtor "new" []
, just $ mkConstMethod "interval" [] intT
-- , just $ mkConstMethod "intervalAsDuration" [] $ objT c_std::chrono::milliseconds
, just $ mkConstMethod "isActive" [] boolT
, just $ mkConstMethod "isSingleShot" [] boolT
, test (qtVersion >= [5, 0]) $ mkConstMethod "remainingTime" [] intT
-- , just $ mkConstMethod "remainingTimeAsDuration" [] $ objT c_std::chrono::milliseconds
, just $ mkMethod "setInterval" [intT] voidT
-- , just $ mkMethod' "setInterval" "setInterval" [objT c_std::chrono::milliseconds] voidT
, just $ mkMethod "setSingleShot" [boolT] voidT
-- , just $ mkMethod "setTimerType" [objT c_Qt::TimerType] voidT
, just $ mkMethod "start" [intT] voidT
, just $ mkConstMethod "timerId" [] intT
-- , just $ mkConstMethod "timerType" [] $ objT c_Qt::TimerType
]
s_timeout = makeSignal c_QTimer "timeout" c_Listener
...@@ -58,6 +58,9 @@ module Graphics.UI.Qtah.Generator.Interface.Core.Types ( ...@@ -58,6 +58,9 @@ module Graphics.UI.Qtah.Generator.Interface.Core.Types (
bs_WindowStates, bs_WindowStates,
e_WindowType, e_WindowType,
bs_WindowFlags, bs_WindowFlags,
e_MouseEventFlag_version,
e_MouseEventSource_version,
e_ScrollPhase_version
) where ) where
import Data.Bits ((.|.)) import Data.Bits ((.|.))
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
module Graphics.UI.Qtah.Generator.Interface.Gui (modules) where module Graphics.UI.Qtah.Generator.Interface.Gui (modules) where
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QActionEvent as QActionEvent import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QActionEvent as QActionEvent
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QBrush as QBrush
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QClipboard as QClipboard import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QClipboard as QClipboard
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QCloseEvent as QCloseEvent import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QCloseEvent as QCloseEvent
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QColor as QColor import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QColor as QColor
...@@ -31,10 +32,14 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QInputEvent as QInputE ...@@ -31,10 +32,14 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QInputEvent as QInputE
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QIntValidator as QIntValidator import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QIntValidator as QIntValidator
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QKeyEvent as QKeyEvent import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QKeyEvent as QKeyEvent
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QMouseEvent as QMouseEvent import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QMouseEvent as QMouseEvent
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QPainter as QPainter
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QPainterPath as QPainterPath
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QPen as QPen
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QPolygon as QPolygon import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QPolygon as QPolygon
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QPolygonF as QPolygonF import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QPolygonF as QPolygonF
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QRegion as QRegion import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QRegion as QRegion
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QShowEvent as QShowEvent import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QShowEvent as QShowEvent
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QTransform as QTransform
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QValidator as QValidator import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QValidator as QValidator
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QWheelEvent as QWheelEvent import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QWheelEvent as QWheelEvent
import Graphics.UI.Qtah.Generator.Module (AModule) import Graphics.UI.Qtah.Generator.Module (AModule)
...@@ -44,6 +49,7 @@ import Graphics.UI.Qtah.Generator.Module (AModule) ...@@ -44,6 +49,7 @@ import Graphics.UI.Qtah.Generator.Module (AModule)
modules :: [AModule] modules :: [AModule]
modules = modules =
[ QActionEvent.aModule [ QActionEvent.aModule
, QBrush.aModule
, QClipboard.aModule , QClipboard.aModule
, QCloseEvent.aModule , QCloseEvent.aModule
, QColor.aModule , QColor.aModule
...@@ -57,10 +63,14 @@ modules = ...@@ -57,10 +63,14 @@ modules =
, QIntValidator.aModule , QIntValidator.aModule
, QKeyEvent.aModule , QKeyEvent.aModule
, QMouseEvent.aModule , QMouseEvent.aModule
, QPainter.aModule
, QPainterPath.aModule
, QPen.aModule
, QPolygon.aModule , QPolygon.aModule
, QPolygonF.aModule , QPolygonF.aModule
, QRegion.aModule , QRegion.aModule
, QShowEvent.aModule , QShowEvent.aModule
, QTransform.aModule
, QValidator.aModule , QValidator.aModule
, QWheelEvent.aModule , QWheelEvent.aModule
] ]
-- This file is part of Qtah.
--
-- Copyright 2016-2017 Bryan Gardiner <bog@khumba.net>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module Graphics.UI.Qtah.Generator.Interface.Gui.QBrush (
aModule,
c_QBrush,
) where
import Foreign.Hoppy.Generator.Spec (
Export (ExportClass),
addReqIncludes,
classSetConversionToGc,
classSetEntityPrefix,
ident,
includeStd,
makeClass,
mkCtor,
)
import Foreign.Hoppy.Generator.Spec.ClassFeature (
ClassFeature (Assignable, Copyable, Equatable),
classAddFeatures,
)
import Foreign.Hoppy.Generator.Types (objT)
import Graphics.UI.Qtah.Generator.Interface.Gui.QColor (c_QColor)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
import Graphics.UI.Qtah.Generator.Types
{-# ANN module "HLint: ignore Use camelCase" #-}
aModule =
AQtModule $
makeQtModule ["Gui", "QBrush"]
[ QtExport $ ExportClass c_QBrush ]
c_QBrush =
addReqIncludes [includeStd "QBrush"] $
classSetConversionToGc $
classAddFeatures [Assignable, Copyable, Equatable] $
classSetEntityPrefix "" $
makeClass (ident "QBrush") Nothing [] $
[ mkCtor "new" []
, mkCtor "newWithColor" [objT c_QColor]
]
-- This file is part of Qtah.
--
-- Copyright 2016-2017 Bryan Gardiner <bog@khumba.net>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module Graphics.UI.Qtah.Generator.Interface.Gui.QPainter (
aModule,
c_QPainter,
e_RenderHint,
bs_RenderHints,
) where
import Foreign.Hoppy.Generator.Spec (
Export (ExportClass, ExportEnum, ExportBitspace),
addReqIncludes,
classSetEntityPrefix,
ident,
ident1,
includeStd,
makeClass,
mkCtor,
mkMethod,
)
import Foreign.Hoppy.Generator.Types (voidT, enumT)
import Foreign.Hoppy.Generator.Version (collect, just)
-- import Graphics.UI.Qtah.Generator.Flags (qtVersion)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
import Graphics.UI.Qtah.Generator.Types
{-# ANN module "HLint: ignore Use camelCase" #-}
aModule =
AQtModule $
makeQtModule ["Gui", "QPainter"] $
(QtExport $ ExportClass c_QPainter) :
(QtExport $ ExportEnum e_RenderHint) :
(QtExport $ ExportBitspace bs_RenderHints) :
[]
c_QPainter =
addReqIncludes [includeStd "QPainter"] $
classSetEntityPrefix "" $
makeClass (ident "QPainter") Nothing [] $
collect
[ just $ mkCtor "new" []
, just $ mkMethod "setRenderHint" [enumT e_RenderHint] voidT
]
(e_RenderHint, bs_RenderHints) =
makeQtEnumBitspace (ident1 "QPainter" "RenderHint") "RenderHints" [includeStd "QPainter"] $
[ (0x01, ["antialiasing"])
, (0x02, ["text","antialiasing"])
, (0x04, ["smooth","pixmap","transform"])
, (0x08, ["high","quality","antialiasing"])
, (0x10, ["non","cosmetic","default","pen"])
, (0x20, ["qt4","compatible","painting"])
]
-- This file is part of Qtah.
--
-- Copyright 2016-2017 Bryan Gardiner <bog@khumba.net>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module Graphics.UI.Qtah.Generator.Interface.Gui.QPainterPath (
aModule,
c_QPainterPath,
) where
import Foreign.Hoppy.Generator.Spec (
Export (ExportClass),
addReqIncludes,
classSetConversionToGc,
classSetEntityPrefix,
ident,
includeStd,
makeClass,
mkCtor,
mkMethod',
)
import Foreign.Hoppy.Generator.Spec.ClassFeature (
ClassFeature (Assignable, Copyable, Equatable),
classAddFeatures,
)
import Foreign.Hoppy.Generator.Types (voidT)
import Foreign.Hoppy.Generator.Version (collect, just)
import Graphics.UI.Qtah.Generator.Interface.Core.Types (qreal)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
import Graphics.UI.Qtah.Generator.Types
{-# ANN module "HLint: ignore Use camelCase" #-}
aModule =
AQtModule $
makeQtModule ["Gui", "QPainterPath"]
[ QtExport $ ExportClass c_QPainterPath ]
c_QPainterPath =
addReqIncludes [includeStd "QPainterPath"] $
classSetConversionToGc $
classAddFeatures [Assignable, Copyable, Equatable] $
classSetEntityPrefix "" $
makeClass (ident "QPainterPath") Nothing [] $
collect
[ just $ mkCtor "new" []
, just $ mkMethod' "addRect" "addRectRaw" [qreal, qreal, qreal, qreal] voidT
]
-- This file is part of Qtah.
--
-- Copyright 2016-2017 Bryan Gardiner <bog@khumba.net>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module Graphics.UI.Qtah.Generator.Interface.Gui.QPen (
aModule,
c_QPen,
) where
import Foreign.Hoppy.Generator.Spec (