mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
add parameterisation to the theme name.
This commit is contained in:
parent
2ce04c051c
commit
2aaf094f96
3 changed files with 19 additions and 21 deletions
|
@ -1,22 +1,20 @@
|
|||
/* A file to test imorting C modules for handling arrays to Python */
|
||||
|
||||
#include "kcardgame.hpp"
|
||||
MyKCardDeck::MyKCardDeck()
|
||||
{
|
||||
int argc = 1;
|
||||
char * argv[2]={"pysol",NULL};
|
||||
app = new QGuiApplication(argc, argv);
|
||||
d = new KCardDeck( KCardTheme("svg-ancient-egyptians"), nullptr);
|
||||
MyKCardDeck::MyKCardDeck(QString theme_name)
|
||||
{
|
||||
int argc = 1;
|
||||
char *argv[2] = {"pysol", NULL};
|
||||
app = new QGuiApplication(argc, argv);
|
||||
d = new KCardDeck(KCardTheme(theme_name), nullptr);
|
||||
unsigned int number = 0;
|
||||
QList<quint32> ids;
|
||||
for ( int i = 0; i < 1; ++i )
|
||||
foreach ( const KCardDeck::Rank & r, KCardDeck::standardRanks() )
|
||||
foreach ( const KCardDeck::Suit & s, KCardDeck::standardSuits() )
|
||||
ids << KCardDeck::getId( s, r, number++ );
|
||||
for (int i = 0; i < 1; ++i)
|
||||
foreach (const KCardDeck::Rank &r, KCardDeck::standardRanks())
|
||||
foreach (const KCardDeck::Suit &s, KCardDeck::standardSuits())
|
||||
ids << KCardDeck::getId(s, r, number++);
|
||||
|
||||
d->setDeckContents(ids);
|
||||
d->setCardWidth(150);
|
||||
}
|
||||
}
|
||||
QPixmap *MyKCardDeck::get_card_pixmap(int i)
|
||||
{
|
||||
auto ret = new QPixmap(d->cardPixmap(i, true));
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
#include <QGuiApplication>
|
||||
#include "KCardDeck"
|
||||
#include "KCardTheme"
|
||||
class Q_DECL_EXPORT MyKCardDeck: public QObject
|
||||
class Q_DECL_EXPORT MyKCardDeck : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QGuiApplication* app;
|
||||
KCardDeck * d;
|
||||
explicit MyKCardDeck();
|
||||
public slots:
|
||||
Q_DECL_EXPORT QPixmap *get_card_pixmap(int i);
|
||||
public:
|
||||
QGuiApplication *app;
|
||||
KCardDeck *d;
|
||||
explicit MyKCardDeck(QString);
|
||||
public slots:
|
||||
Q_DECL_EXPORT QPixmap *get_card_pixmap(int i);
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ class SVGManager:
|
|||
def __init__(self, filename):
|
||||
self.filename = filename
|
||||
# self.svg = Rsvg.Handle().new_from_file(filename)
|
||||
self.d = MyKCardDeck()
|
||||
self.d = MyKCardDeck("svg-jolly-royal")
|
||||
|
||||
# Taken from https://stackoverflow.com/questions/44471795
|
||||
# Under MIT License - thanks.
|
||||
|
|
Loading…
Add table
Reference in a new issue