view ui/separatoritemdelegate.cpp @ 1119:5349e2354c48

(issue54) Merge branch runafterinstall There is now an NSIS Plugin that executes the Software after installation using COM in the shell of the current user. With the way over the shell there is no inheritance / token management required. As it is impossible to drop all privileges of a token granted by UAC and still be able to reelevate the Token again with another RunAs call later this round trip over the Shell was necessary.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 16 Sep 2014 19:48:22 +0200
parents 17e1c8f37d72
children
line wrap: on
line source
/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */
#include <QtWidgets>

#include "separatoritemdelegate.h"

void SeparatorItemDelegate::paint(QPainter *painter,
    const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    // Save the current painter.
    painter->save();

    // Get the position for separator line.
    int topLeftY = option.rect.topLeft().y();
    int height = option.rect.height();
    int middle = topLeftY + (height / 2);

    // Draw the first part.
    QPen linePen(Qt::black, 2, Qt::SolidLine);
    painter->setPen(linePen);
    painter->drawLine(10, middle, 80, middle);

    // Draw the text.
    QString text = index.data().toString();
    QRect rect = option.rect.adjusted(85, -2, 0, -2);
    painter->drawText(rect.left(), rect.top(), rect.width(), rect.height(),
        Qt::AlignVCenter|Qt::AlignLeft, text, &rect);

    // Draw the second part.
    painter->drawLine(rect.topRight().x() + 5, middle, rect.topRight().x() + 75, middle);

    // Restore the painter to have an unmodified painter for the next draw
    // action.
    painter->restore();
    return;
}

http://wald.intevation.org/projects/trustbridge/