author | sandman <sandman> | 2002-09-27 00:54:58 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-27 00:54:58 (UTC) |
commit | dcd5eb6949787321c278b10772bd75a27ec6d508 (patch) (unidiff) | |
tree | 12525523ac676e6b43419f742afb6b1d007d61da /libopie | |
parent | aec4806d28c0422e9d0572e9601d6dc41a9cdd61 (diff) | |
download | opie-dcd5eb6949787321c278b10772bd75a27ec6d508.zip opie-dcd5eb6949787321c278b10772bd75a27ec6d508.tar.gz opie-dcd5eb6949787321c278b10772bd75a27ec6d508.tar.bz2 |
- size tweak for OColorButton
- new convenience methods in OFontSelector
-rw-r--r-- | libopie/ocolorbutton.cpp | 5 | ||||
-rw-r--r-- | libopie/ofontselector.cpp | 5 | ||||
-rw-r--r-- | libopie/ofontselector.h | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/libopie/ocolorbutton.cpp b/libopie/ocolorbutton.cpp index 96e5612..4734c0c 100644 --- a/libopie/ocolorbutton.cpp +++ b/libopie/ocolorbutton.cpp | |||
@@ -42,25 +42,28 @@ public: | |||
42 | 42 | ||
43 | OColorButton::OColorButton ( QWidget *parent, const char *name ) | 43 | OColorButton::OColorButton ( QWidget *parent, const char *name ) |
44 | : QPushButton ( parent, name ) | 44 | : QPushButton ( parent, name ) |
45 | { | 45 | { |
46 | d = new OColorButtonPrivate; | 46 | d = new OColorButtonPrivate; |
47 | 47 | ||
48 | d-> m_menu = new ColorPopupMenu ( black, 0, 0 ); | 48 | d-> m_menu = new ColorPopupMenu ( black, 0, 0 ); |
49 | setPopup ( d-> m_menu ); | 49 | setPopup ( d-> m_menu ); |
50 | //setPopupDelay ( 0 ); | 50 | //setPopupDelay ( 0 ); |
51 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); | 51 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); |
52 | 52 | ||
53 | updateColor ( black ); | 53 | updateColor ( black ); |
54 | setMinimumSize ( sizeHint ( ) + QSize ( 8, 0 )); | 54 | |
55 | QSize s = sizeHint ( ) + QSize ( 12, 0 ); | ||
56 | setMinimumSize ( s ); | ||
57 | setMaximumSize ( s. width ( ) * 2, s. height ( )); | ||
55 | } | 58 | } |
56 | 59 | ||
57 | OColorButton::~OColorButton ( ) | 60 | OColorButton::~OColorButton ( ) |
58 | { | 61 | { |
59 | delete d; | 62 | delete d; |
60 | } | 63 | } |
61 | 64 | ||
62 | QColor OColorButton::color ( ) const | 65 | QColor OColorButton::color ( ) const |
63 | { | 66 | { |
64 | return d-> m_color; | 67 | return d-> m_color; |
65 | } | 68 | } |
66 | 69 | ||
diff --git a/libopie/ofontselector.cpp b/libopie/ofontselector.cpp index d32aeb4..39440af 100644 --- a/libopie/ofontselector.cpp +++ b/libopie/ofontselector.cpp | |||
@@ -103,24 +103,29 @@ OFontSelector::OFontSelector ( QWidget *parent, const char *name, WFlags fl ) : | |||
103 | m_font_size_list = new QComboBox( this, "SizeListBox" ); | 103 | m_font_size_list = new QComboBox( this, "SizeListBox" ); |
104 | connect( m_font_size_list, SIGNAL( activated( int ) ), | 104 | connect( m_font_size_list, SIGNAL( activated( int ) ), |
105 | this, SLOT( fontSizeClicked( int ) ) ); | 105 | this, SLOT( fontSizeClicked( int ) ) ); |
106 | gridLayout->addWidget( m_font_size_list, 3, 1 ); | 106 | gridLayout->addWidget( m_font_size_list, 3, 1 ); |
107 | 107 | ||
108 | loadFonts ( m_font_family_list ); | 108 | loadFonts ( m_font_family_list ); |
109 | } | 109 | } |
110 | 110 | ||
111 | OFontSelector::~OFontSelector ( ) | 111 | OFontSelector::~OFontSelector ( ) |
112 | { | 112 | { |
113 | } | 113 | } |
114 | 114 | ||
115 | bool OFontSelector::setSelectedFont ( const QFont &f ) | ||
116 | { | ||
117 | return setSelectedFont ( f. family ( ), m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); | ||
118 | } | ||
119 | |||
115 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & /*charset*/ ) | 120 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & /*charset*/ ) |
116 | { | 121 | { |
117 | QString sizeStr = QString::number ( sizeVal ); | 122 | QString sizeStr = QString::number ( sizeVal ); |
118 | 123 | ||
119 | QListBoxItem *family = m_font_family_list-> findItem ( familyStr ); | 124 | QListBoxItem *family = m_font_family_list-> findItem ( familyStr ); |
120 | if ( !family ) | 125 | if ( !family ) |
121 | family = m_font_family_list-> findItem ( "Helvetica" ); | 126 | family = m_font_family_list-> findItem ( "Helvetica" ); |
122 | if ( !family ) | 127 | if ( !family ) |
123 | family = m_font_family_list-> firstItem ( ); | 128 | family = m_font_family_list-> firstItem ( ); |
124 | m_font_family_list-> setCurrentItem ( family ); | 129 | m_font_family_list-> setCurrentItem ( family ); |
125 | fontFamilyClicked ( m_font_family_list-> index ( family )); | 130 | fontFamilyClicked ( m_font_family_list-> index ( family )); |
126 | 131 | ||
diff --git a/libopie/ofontselector.h b/libopie/ofontselector.h index 2011e43..b3aa862 100644 --- a/libopie/ofontselector.h +++ b/libopie/ofontselector.h | |||
@@ -40,24 +40,25 @@ class OFontSelector : public QWidget | |||
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | OFontSelector ( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 44 | OFontSelector ( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
45 | virtual ~OFontSelector ( ); | 45 | virtual ~OFontSelector ( ); |
46 | 46 | ||
47 | bool selectedFont ( QString &family, QString &style, int &size ); | 47 | bool selectedFont ( QString &family, QString &style, int &size ); |
48 | bool selectedFont ( QString &family, QString &style, int &size, QString &charset ); | 48 | bool selectedFont ( QString &family, QString &style, int &size, QString &charset ); |
49 | 49 | ||
50 | QFont selectedFont ( ); | 50 | QFont selectedFont ( ); |
51 | 51 | ||
52 | bool setSelectedFont ( const QFont & ); | ||
52 | bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 ); | 53 | bool setSelectedFont ( const QString &family, const QString &style, int size, const QString &charset = 0 ); |
53 | 54 | ||
54 | QString fontFamily ( ) const; | 55 | QString fontFamily ( ) const; |
55 | QString fontStyle ( ) const; | 56 | QString fontStyle ( ) const; |
56 | int fontSize ( ) const; | 57 | int fontSize ( ) const; |
57 | QString fontCharSet ( ) const; | 58 | QString fontCharSet ( ) const; |
58 | 59 | ||
59 | signals: | 60 | signals: |
60 | void fontSelected ( const QFont & ); | 61 | void fontSelected ( const QFont & ); |
61 | 62 | ||
62 | protected slots: | 63 | protected slots: |
63 | virtual void fontFamilyClicked ( int ); | 64 | virtual void fontFamilyClicked ( int ); |