Verified 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 @@
/qtah/src/Graphics/UI/Qtah/Gui/Q*
/qtah/src/Graphics/UI/Qtah/Internal/Callback.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/Std.hs
/qtah/src/Graphics/UI/Qtah/Widgets/Q*
......@@ -56,6 +57,11 @@
/qtah-qt?/src/Graphics/UI/Qtah/Gui/Q*
/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/SceneEventListener.hs
/qtah-qt?/src/Graphics/UI/Qtah/Internal/Listener.hs
/qtah-qt?/src/Graphics/UI/Qtah/Std.hs
/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
build outputs (`clean.sh`) before running the build script again.
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
dynamically, by passing the `--enable-executable-dynamic` flag to `cabal
configure` or `cabal install`. This includes unit tests.
`qtah` if building locally). Executables that use Qtah need to be linked
dynamically, so put `ghc-options: -dynamic` in your Cabal file. This includes
unit tests.
There is a demo program in `/qtah-examples` that can be built and run after
installing Qtah:
$ cd qtah-examples
$ cabal configure --enable-executable-dynamic
$ cabal run
### Dependencies
......
......@@ -84,8 +84,7 @@ sdist
echo
msg "Building and installing qtah."
goToPkg qtah
run cabal configure ${QTAH_QT_FLAGS:+--flags="$QTAH_QT_FLAGS"} \
--enable-tests --enable-executable-dynamic
run cabal configure ${QTAH_QT_FLAGS:+--flags="$QTAH_QT_FLAGS"} --enable-tests
run cabal build ${QTAH_BUILD_JOBS:+--jobs="$QTAH_BUILD_JOBS"}
# We call the test executable directly instead of running 'cabal test', for
# distros such as Debian Stretch that are affected by
......@@ -98,14 +97,14 @@ run cabal test
# silence them.
run cabal haddock --haddock-options=--no-print-missing-docs
run cabal install ${QTAH_QT_FLAGS:+--flags="$QTAH_QT_FLAGS"} \
--enable-tests --enable-executable-dynamic --force-reinstalls
--enable-tests --force-reinstalls
sdist
if [[ $commands = *\ examples\ * ]] || [[ $commands = *\ sdist\ * ]]; then
echo
msg "Building qtah-examples."
goToPkg qtah-examples
run cabal configure --enable-executable-dynamic
run cabal configure
run cabal build
sdist
fi
......@@ -19,6 +19,11 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QEvent>
#include <QGraphicsItem>
#include <QObject>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QWidget>
#include "b_callback.hpp"
namespace qtah {
......@@ -60,6 +65,44 @@ private:
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 qtah
......
......@@ -15,25 +15,7 @@
-- 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/>.
import Control.Monad (unless)
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)
import Distribution.Simple (defaultMain)
main :: IO ()
main = defaultMainWithHooks qtahHooks
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'."
main = defaultMain
......@@ -26,5 +26,5 @@ executable qtah-examples
, filepath >=1.0 && <1.5
, hoppy-runtime >=0.3 && <0.4
, 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
......@@ -76,12 +76,14 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Core.QString
, Graphics.UI.Qtah.Generator.Interface.Core.QStringList
, 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.QVariant
, Graphics.UI.Qtah.Generator.Interface.Core.QVector
, Graphics.UI.Qtah.Generator.Interface.Core.Types
, Graphics.UI.Qtah.Generator.Interface.Gui
, 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.QCloseEvent
, Graphics.UI.Qtah.Generator.Interface.Gui.QColor
......@@ -95,10 +97,14 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Gui.QIntValidator
, Graphics.UI.Qtah.Generator.Interface.Gui.QKeyEvent
, 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.QPolygonF
, Graphics.UI.Qtah.Generator.Interface.Gui.QRegion
, 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.QWheelEvent
, Graphics.UI.Qtah.Generator.Interface.Imports
......@@ -106,8 +112,10 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Internal.Callback
, Graphics.UI.Qtah.Generator.Interface.Internal.EventListener
, 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.QAbstractButton
, Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractGraphicsShapeItem
, Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractScrollArea
, Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSlider
, Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSpinBox
......@@ -124,6 +132,15 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Widgets.QFileDialog
, Graphics.UI.Qtah.Generator.Interface.Widgets.QFormLayout
, 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.QGroupBox
, Graphics.UI.Qtah.Generator.Interface.Widgets.QHBoxLayout
......
......@@ -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.QStringList as QStringList
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.QVariant as QVariant
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QVector as QVector
......@@ -71,6 +72,7 @@ modules =
, QString.aModule
, QStringList.aModule
, QStringListModel.aModule
, QTimer.aModule
, QTimerEvent.aModule
, QVariant.aModule
, Types.aModule
......
......@@ -36,6 +36,7 @@ import Foreign.Hoppy.Generator.Types (boolT, intT, objT, ptrT, voidT)
import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Flags (qtVersion)
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 Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent)
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 (
bs_WindowStates,
e_WindowType,
bs_WindowFlags,
e_MouseEventFlag_version,
e_MouseEventSource_version,
e_ScrollPhase_version
) where
import Data.Bits ((.|.))
......
......@@ -18,6 +18,7 @@
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.QBrush as QBrush
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.QColor as QColor
......@@ -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.QKeyEvent as QKeyEvent
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.QPolygonF as QPolygonF
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.QTransform as QTransform
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QValidator as QValidator
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QWheelEvent as QWheelEvent
import Graphics.UI.Qtah.Generator.Module (AModule)
......@@ -44,6 +49,7 @@ import Graphics.UI.Qtah.Generator.Module (AModule)
modules :: [AModule]
modules =
[ QActionEvent.aModule
, QBrush.aModule
, QClipboard.aModule
, QCloseEvent.aModule
, QColor.aModule
......@@ -57,10 +63,14 @@ modules =
, QIntValidator.aModule
, QKeyEvent.aModule
, QMouseEvent.aModule
, QPainter.aModule
, QPainterPath.aModule
, QPen.aModule
, QPolygon.aModule
, QPolygonF.aModule
, QRegion.aModule
, QShowEvent.aModule
, QTransform.aModule
, QValidator.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 (
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", "QPen"]
[ QtExport $ ExportClass c_QPen ]
c_QPen =
addReqIncludes [includeStd "QPen"] $
classSetConversionToGc $
classAddFeatures [Assignable, Copyable, Equatable] $
classSetEntityPrefix "" $
makeClass (ident "QPen") Nothing [] $
[ mkCtor "new" []
, mkCtor "newWithColor" [objT c_QColor]
]
......@@ -17,6 +17,7 @@
module Graphics.UI.Qtah.Generator.Interface.Gui.QPolygonF (
aModule,
c_QPolygonF
) where
import Foreign.Hoppy.Generator.Spec (
......
-- 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.QTransform (
aModule,
c_QTransform,
) 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 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", "QTransform"]
[ QtExport $ ExportClass c_QTransform ]
c_QTransform =
addReqIncludes [includeStd "QTransform"] $
classSetConversionToGc $
classAddFeatures [Assignable, Copyable, Equatable] $
classSetEntityPrefix "" $
makeClass (ident "QTransform") Nothing [] $
[ mkCtor "new2x2" [qreal, qreal, qreal, qreal, qreal, qreal]
]
......@@ -24,6 +24,7 @@ module Graphics.UI.Qtah.Generator.Interface.Imports (
importForForeign,
importForForeignC,
importForPrelude,
importForSceneEvent,
importForSignal,
importForRuntime,
) where
......@@ -45,6 +46,9 @@ importForForeignC = hsQualifiedImport "Foreign.C" "QtahFC"
importForPrelude :: HsImportSet
importForPrelude = hsQualifiedImport "Prelude" "QtahP"
importForSceneEvent :: HsImportSet
importForSceneEvent = hsQualifiedImport "Graphics.UI.Qtah.SceneEvent" "QtahSceneEvent"
importForSignal :: HsImportSet