Vidalia 0.2.15
LogMessageColumnDelegate.cpp
Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file LogMessageColumnDelegate.cpp
00013 ** \brief Delegate responsible for rendering the log message column
00014 */
00015 
00016 #include "LogMessageColumnDelegate.h"
00017 
00018 
00019 /** Default constructor. */
00020 LogMessageColumnDelegate::LogMessageColumnDelegate(QObject *parent)
00021   : QItemDelegate(parent)
00022 {
00023 }
00024 
00025 /** Overrides the default paint() method so that we can prevent Qt from
00026  * munging Tor's log messages when using a Right-to-Left layout (e.g. when
00027  * viewing Vidalia in Farsi). */
00028 void
00029 LogMessageColumnDelegate::paint(QPainter *painter,
00030                                 const QStyleOptionViewItem &option,
00031                                 const QModelIndex &index) const
00032 {
00033   QStyleOptionViewItem styleOption = option;  
00034   styleOption.direction = Qt::LeftToRight;
00035 
00036   QItemDelegate::paint(painter, styleOption, index);
00037 }
00038