Browse Source

fridgegrid: fixed some formatting problems

tags/1.3
Sven Oliver Moll 10 months ago
parent
commit
effd17ce94
3 changed files with 19 additions and 12 deletions
  1. 8
    6
      src/fridgegrid/DragLabel.cpp
  2. 11
    5
      src/fridgegrid/DragWidget.cpp
  3. 0
    1
      src/fridgegrid/main.cpp

+ 8
- 6
src/fridgegrid/DragLabel.cpp View File

@@ -194,16 +194,16 @@ void DragLabel::draw()
bool rotate = false;
QSize grid( mpParent->gridSize() );

if( (mSize.width() * grid.width() - 4) >= (mSize.height() * grid.height() - 4) )
if( (mSize.width() * grid.width() - 3) >= (mSize.height() * grid.height() - 3) )
{
imgWidth = (mSize.width() * grid.width() - 4);
imgHeight = (mSize.height() * grid.height() - 4);
imgWidth = (mSize.width() * grid.width() - 3);
imgHeight = (mSize.height() * grid.height() - 3);
rotate = false;
}
else
{
imgHeight = (mSize.width() * grid.width() - 4);
imgWidth = (mSize.height() * grid.height() - 4);
imgHeight = (mSize.width() * grid.width() - 3);
imgWidth = (mSize.height() * grid.height() - 3);
rotate = true;
}
QImage image( imgWidth, imgHeight, QImage::Format_ARGB32_Premultiplied );
@@ -212,7 +212,9 @@ void DragLabel::draw()

QPainter painter;
painter.begin( &image );
painter.setRenderHint( QPainter::Antialiasing );
painter.setRenderHints( QPainter::Antialiasing |
QPainter::TextAntialiasing |
QPainter::QPainter::HighQualityAntialiasing, false );
painter.setBrush( mColor );
painter.drawRect( QRectF(0.5, 0.5, image.width()-1, image.height()-1) );


+ 11
- 5
src/fridgegrid/DragWidget.cpp View File

@@ -28,19 +28,23 @@
#include <QTextStream>
#include <QTextEdit>

//#include <QSize>

/* local library headers */

/* local headers */
#include "DragLabel.hpp"

/* workaround: mac has a different font size interpretation as linux and windows */
#ifdef Q_OS_MAC
static const int ERBOS_FONTSIZE = 8;
#else
static const int ERBOS_FONTSIZE = 6;
#endif

DragWidget::DragWidget( QWidget *parent )
: QWidget( parent )
, mpTextEdit( 0 )
, mGridStyle( "Default", QSize(15,15),
QFont("ErbosDraco Nova Open NBP", 6), QPoint( 2, 1 ), true )
, mGridStyle( "Default", QSize(14,14),
QFont("ErbosDraco Nova Open NBP", ERBOS_FONTSIZE), QPoint( 2, 1 ), true )
{
setMinimumSize( 400, 200 );
setAcceptDrops( true );
@@ -265,7 +269,9 @@ void DragWidget::paintEvent( QPaintEvent *event )
{
Q_UNUSED( event );
QPainter painter( this );
painter.setRenderHint( QPainter::Antialiasing );
painter.setRenderHints( QPainter::Antialiasing |
QPainter::TextAntialiasing |
QPainter::QPainter::HighQualityAntialiasing, false );
painter.setBrush( Qt::black );
for( int i = mGridStyle.gridSize().width() - 1; i < size().width() ; i += mGridStyle.gridSize().width() )
{

+ 0
- 1
src/fridgegrid/main.cpp View File

@@ -30,7 +30,6 @@ int main( int argc, char *argv[] )
foreach( const QFileInfo &entry, dir.entryInfoList( QStringList("*.ttf")) )
{
int id = QFontDatabase::addApplicationFont( entry.absoluteFilePath() );
qDebug() << entry.absoluteFilePath() << id << QFontDatabase::applicationFontFamilies( id );
}
}
MainWindow window;

Loading…
Cancel
Save