示例#1
0
Vruler::Vruler(ScribusView *pa, ScribusDoc *doc) : QWidget(pa)
{
	prefsManager=PrefsManager::instance();
	setBackgroundRole(QPalette::Window);
	setAutoFillBackground(true);
	QPalette palette;
	palette.setBrush(QPalette::Window, QColor(255, 255, 255));
	setPalette(palette);
	currDoc = doc;
	currView = pa;
	offs = 0;
	oldMark = 0;
	Mpressed = false;
	drawMark = false;
	setMouseTracking(true);
	rulerGesture = new RulerGesture(currView, RulerGesture::VERTICAL);
	unitChange();
}
示例#2
0
KoTinyButton::KoTinyButton( Action a, QWidget* parent )
		: QWidget( parent ), m_action( a )
{
	m_pressed = false;
	m_toggled = false;
	switch ( a )
	{
		case Sticky:
			m_bitmap = QBitmap::fromData( QSize( 5, 5 ), notstickybits );
			break;

		default:
			m_bitmap = QBitmap::fromData( QSize(5, 5), closebits );
	}
	m_bitmap.setMask( m_bitmap );
	setMinimumSize( 7, 7 );
	setBackgroundRole( QPalette::Window );
} // KoTinyButton::KoTinyButton
transitionFunctionRenderAreaWidget::transitionFunctionRenderAreaWidget(transitionFunction* functionData, QWidget *parent)
    : QWidget(parent)
{
	this->functionData = functionData;
	setMouseTracking(true);
    setBackgroundRole(QPalette::Base);
    setAutoFillBackground(true);
	Qt::PenStyle style = Qt::PenStyle(Qt::PenStyle::SolidLine);
	Qt::PenCapStyle cap = Qt::PenCapStyle(Qt::PenCapStyle::FlatCap);
	Qt::PenJoinStyle join = Qt::PenJoinStyle(Qt::PenJoinStyle::MiterJoin);
	pen = QPen(Qt::black, 1, style, cap, join);
	pointStyleMoveable = false;
	selectedPoint = -1;
	lengthToPickPoint = 8;
	mouseX = 0;
	mouseY = 0;
	deny = false;
}
示例#4
0
MonitorFixture::MonitorFixture(QWidget* parent, Doc* doc)
    : QFrame(parent)
    , m_doc(doc)
{
    Q_ASSERT(doc != NULL);

    m_fixtureLabel = NULL;
    m_fixture = Fixture::invalidId();
    m_channelStyle = Monitor::DMXChannels;
    m_valueStyle = Monitor::DMXValues;

    new QGridLayout(this);
    layout()->setMargin(3);

    setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
    setAutoFillBackground(true);
    setBackgroundRole(QPalette::Window);
}
示例#5
0
Canvas::Canvas(Window *const window, bool left):
    window_(window)
{
    setParent(window);
    setBackgroundRole(QPalette::Base);
    setAutoFillBackground(true);
    setFocusPolicy(Qt::WheelFocus);

    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    size_in_pixels_ = width();
    canvas_delegate_ = new Canvas_Delegate();
    canvas_delegate_->left_canvas_ = left;

    left_canvas_ = left;

    reset_canvas();
}
示例#6
0
Canvas::Canvas()
        : QWidget()
        , m_zoom(1)
        , m_rtree(4, 2)
//, m_rtree( 2, 1 )
        , m_tool(0)
        , m_createTool(this)
        , m_selectTool(this)
        , m_removeTool(this)
        , m_file("data.trc")
        , m_listId(0)
        , m_paintTree(false)
{
    m_tool = &m_createTool;
    setBackgroundRole(QPalette::Base);
    m_file.open(QIODevice::WriteOnly | QIODevice::Unbuffered);
    m_out.setDevice(&m_file);
}
示例#7
0
  /*!
   * \author Ingemar Axelsson
   *
   * \brief The class constructor
   */
  CellCursor::CellCursor(QWidget *parent)
    : Cell(parent),
    clickedOn_( false )
  {
    setHeight(3);
    QWidget *content = new CursorWidget(this);

    setMainWidget(content);
    hideTreeView(true);
    // PORT >> setBackgroundMode(Qt::PaletteBase);
    setBackgroundRole( QPalette::Base );
    setBackgroundColor(QColor(100,100,100));

    // 2006-04-27 AF, set cursor shape for cell cursor
    QCursor mousecursor = cursor();
    mousecursor.setShape( Qt::SizeHorCursor );
    setCursor( mousecursor );
  }
toResultDataSingle::toResultDataSingle(QWidget *parent)
        : QWidget(parent)
{

    Row       = -1;
    Container = NULL;
    Model     = NULL;

    setBackgroundRole(QPalette::Window);

    // fscking qscrollarea won't resize this is added
    QHBoxLayout *h = new QHBoxLayout;
    h->setContentsMargins(0, 0, 0, 0);
    h->setSpacing(0);
    setLayout(h);

    setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
}
示例#9
0
ModelView::ModelView(QWidget* parent) :
  QFrame(parent),
  ui(new Ui::ModelView) {
  ui->setupUi(this);
  setBackgroundRole(QPalette::Base);

  connect(ui->buttonAdd, SIGNAL(clicked()), SLOT(addFile()));
  connect(ui->interpreter, SIGNAL(currentIndexChanged(int)), SLOT(onInterpreterChanged(int)));
  connect(ui->add, SIGNAL(clicked()), SLOT(add()));
  connect(ui->del, SIGNAL(clicked()), SLOT(del()));

  ui->userIdText->setEnabled(false);
  ui->categoryCombo->setEnabled(false);

  ui->modelInfo->setText(dengueme::getProjectType());
  ui->modelInfo->setVisible(false);
  ui->modelType->setVisible(false);
}
示例#10
0
void DropArea::dropEvent(QDropEvent *event)
{
	/** Accept only urls */
	if(event->mimeData()->hasUrls()) {

		/** Set default background */
		setBackgroundRole(QPalette::Dark);

		/** Set action to move */
		event->setDropAction(Qt::TargetMoveAction);

		/** Accept event */
		event->accept();

		/** Emit the dropped event */
		emit dropped(event->mimeData()->urls());
	}
}
WizUserCipherForm::WizUserCipherForm(WizExplorerApp& app, QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::WizUserCipherForm)
    , m_app(app)
    , m_bSaveForSession(false)
{
    ui->setupUi(this);
    ui->editUserCipher->setEchoMode(QLineEdit::Password);
    ui->editUserCipher->setAttribute(Qt::WA_MacShowFocusRect, false);

    setAutoFillBackground(true);
    setAttribute(Qt::WA_MacShowFocusRect, false);
    setBackgroundRole(QPalette::Midlight);
    //
    ui->checkSave->setVisible(false);


    QString strIconNormal = Utils::WizStyleHelper::skinResourceFileName("mac_icons_password_done", true); // ::WizGetSkinResourcePath(m_app.userSettings().skin())
//            + "mac_icons_password_done.png";
    QString strIconHot = Utils::WizStyleHelper::skinResourceFileName("mac_icons_password_done_hot", true); // ::WizGetSkinResourcePath(m_app.userSettings().skin())
//            + "mac_icons_password_done_hot.png";
    QString strIconDown = Utils::WizStyleHelper::skinResourceFileName("mac_icons_password_done_down", true); // ::WizGetSkinResourcePath(m_app.userSettings().skin())
//            + "mac_icons_password_done_down.png";

    ui->editUserCipher->setFixedHeight(19);
    QSize szBtn(19, 19);
    ui->buttonOk->setMinimumSize(szBtn);
    ui->buttonOk->setMaximumSize(szBtn);
    ui->buttonOk->setIconNormal(strIconNormal);
    ui->buttonOk->setIconHot(strIconHot);
    ui->buttonOk->setIconDown(strIconDown);
    ui->buttonOk->setStatusNormal();
    ui->buttonOk->setLockNormalStatus(true);


    m_animation = new QPropertyAnimation(ui->editUserCipher, "pos", this);

    connect(ui->editUserCipher, SIGNAL(returnPressed()), SLOT(onButtonOK_clicked()));
    connect(ui->editUserCipher, SIGNAL(textChanged(const QString&)),
            SLOT(onCipher_changed(const QString&)));
    connect(ui->buttonOk, SIGNAL(clicked()), SLOT(onButtonOK_clicked()));
    connect(ui->checkSave, SIGNAL(stateChanged(int)), SLOT(onCheckSave_stateChanged(int)));

}
示例#12
0
//! [0]
SortingBox::SortingBox()
{
//! [0] //! [1]
    setMouseTracking(true);
//! [1] //! [2]
    setBackgroundRole(QPalette::Base);
//! [2]

    itemInMotion = 0;

//! [3]
    newCircleButton = createToolButton(tr("New Circle"),
                                       QIcon(":/images/circle.png"),
                                       SLOT(createNewCircle()));

    newSquareButton = createToolButton(tr("New Square"),
                                       QIcon(":/images/square.png"),
                                       SLOT(createNewSquare()));

    newTriangleButton = createToolButton(tr("New Triangle"),
                                         QIcon(":/images/triangle.png"),
                                         SLOT(createNewTriangle()));

    circlePath.addEllipse(QRect(0, 0, 100, 100));
    squarePath.addRect(QRect(0, 0, 100, 100));

    qreal x = trianglePath.currentPosition().x();
    qreal y = trianglePath.currentPosition().y();
    trianglePath.moveTo(x + 120 / 2, y);
    trianglePath.lineTo(0, 100);
    trianglePath.lineTo(120, 100);
    trianglePath.lineTo(x + 120 / 2, y);

//! [3] //! [4]
    setWindowTitle(tr("Tool Tips"));
    resize(500, 300);

    createShapeItem(circlePath, tr("Circle"), initialItemPosition(circlePath),
                    initialItemColor());
    createShapeItem(squarePath, tr("Square"), initialItemPosition(squarePath),
                    initialItemColor());
    createShapeItem(trianglePath, tr("Triangle"),
                    initialItemPosition(trianglePath), initialItemColor());
}
示例#13
0
void DropArea::dropEvent(QDropEvent *event)
{
    const QMimeData *mimeData = event->mimeData();

    if (mimeData->hasImage()) {
        setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
    } else if (mimeData->hasHtml()) {
        setText(mimeData->html());
        setTextFormat(Qt::RichText);
    } else if (mimeData->hasText()) {
        setText(mimeData->text());
        setTextFormat(Qt::PlainText);
    } else {
        setText(tr("Cannot display data"));
    }

    setBackgroundRole(QPalette::Dark);
    event->acceptProposedAction();
}
示例#14
0
HelpPopup::HelpPopup(QWidget* parent) : QLabel(parent)
{
    setForegroundRole(QPalette::ToolTipText);
    setBackgroundRole(QPalette::ToolTipBase);
    setPalette(QToolTip::palette());
    ensurePolished();
    setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
    setFrameStyle(QFrame::NoFrame);
    setAlignment(Qt::AlignLeft);
    setIndent(1);
    setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
    setMouseTracking(true);

    setWindowFlags(Qt::Popup);
    setAttribute(Qt::WA_DeleteOnClose);

    QShortcut* shortcut = new QShortcut(QKeySequence("Esc"), this);
    connect(shortcut, SIGNAL(activated()), this, SLOT(close()));
}
ImageViewerWidget::ImageViewerWidget(QWidget *parent) :
    QScrollArea(parent), m_Scale(1.0)
{
    m_FlickCharm = new FlickCharm(this);
    m_FlickCharm->activateOn(this);
    m_Image = new QLabel(this);
    m_Image->setBackgroundRole(QPalette::Base);
    m_Image->setScaledContents(true);
    m_Image->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    m_Image->setStyleSheet("QLabel {"
        "background-color: transparent;"
        "background-image: url(':/images/checkerboard.png');"
        "border: 1px dashed #000000;"
    "}");
    setAlignment(Qt::AlignCenter);
    setBackgroundRole(QPalette::Dark);
    setWidget(m_Image);
    viewport()->setCursor(Qt::OpenHandCursor);
}
示例#16
0
StartTab::StartTab(MainWindow *mainWindow)
{
	setBackgroundRole(QPalette::Base);
	setAutoFillBackground(true);

	QGridLayout *gridLayout = new QGridLayout(this);
	gridLayout->setAlignment(Qt::AlignCenter);
	gridLayout->setMargin(10);
	gridLayout->setSpacing(15);

	QAbstractButton *button =
		addShortcut(i18n("&1 Play File"), QIcon::fromTheme(QLatin1String("video-x-generic"), QIcon(":video-x-generic")), this);
	button->setShortcut(Qt::Key_1);
	button->setWhatsThis(i18n("Open dialog to play a file"));
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(open()));
	gridLayout->addWidget(button, 0, 0);

	button = addShortcut(i18n("&2 Play Audio CD"), QIcon::fromTheme(QLatin1String("media-optical-audio"), QIcon(":media-optical-audio")), this);
	button->setShortcut(Qt::Key_2);
	button->setWhatsThis(i18n("Start playing an audio CD. It assumes that the CD is already there at the CD driver"));
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(openAudioCd()));
	gridLayout->addWidget(button, 0, 1);

	button = addShortcut(i18n("&3 Play Video CD"), QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), this);
	button->setShortcut(Qt::Key_3);
	button->setWhatsThis(i18n("Start playing a Video CD. It assumes that the CD is already there at the CD driver"));
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(openVideoCd()));
	gridLayout->addWidget(button, 0, 2);

	button = addShortcut(i18n("&4 Play DVD"), QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), this);
	button->setShortcut(Qt::Key_4);
	button->setWhatsThis(i18n("Start playing a DVD. It assumes that the DVD is already there at the DVD driver"));
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(openDvd()));
	gridLayout->addWidget(button, 1, 0);

#if HAVE_DVB == 1
	button = addShortcut(i18n("&5 Digital TV"), QIcon::fromTheme(QLatin1String("video-television"), QIcon(":video-television")), this);
	button->setShortcut(Qt::Key_5);
	button->setWhatsThis("Open the Digital TV live view window. If the TV channels are already scanned, it will start playing the last channel");
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(playDvb()));
	gridLayout->addWidget(button, 1, 1);
#endif /* HAVE_DVB == 1 */
}
示例#17
0
void medDropSite::dropEvent(QDropEvent *event)
{
    const QMimeData *mimeData = event->mimeData();

    if (d->canAutomaticallyChangeAppereance && mimeData->hasImage()) {
        setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
    }

    medDataIndex index( medDataIndex::readMimeData(mimeData) );
    if (index.isValid()) {
        d->index = index;
    }

    setBackgroundRole(QPalette::Base);

    event->acceptProposedAction();
    
    emit objectDropped(d->index);
}
示例#18
0
PlaYUVerApp::PlaYUVerApp() :
        m_pcCurrentSubWindow( NULL ),
        m_pcCurrentVideoSubWindow( NULL ),
        m_pcAboutDialog( NULL )
{

  setWindowModality( Qt::ApplicationModal );
  setWindowModality( Qt::NonModal );

  // DBus
#ifdef USE_QTDBUS
  m_pDBusAdaptor = new PlaYUVerAppAdaptor( this );
#endif

  m_pcWindowHandle = new PlaYUVerSubWindowHandle( this );

  m_appModuleVideo = new VideoHandle( this, m_pcWindowHandle );
  m_appModuleQuality = new QualityHandle( this, m_pcWindowHandle );
  m_appModuleExtensions = new ModulesHandle( this, m_pcWindowHandle, m_appModuleVideo );

  createActions();
  createToolBars();
  createDockWidgets();
  createMenus();
  createStatusBar();
  updateMenus();

  readSettings();

  setWindowTitle( QApplication::applicationName() );
  setWindowIcon( QIcon( ":/images/playuver.png" ) );
  setUnifiedTitleAndToolBarOnMac( true );
  setCentralWidget( m_pcWindowHandle );
  setAcceptDrops( true );
  setBackgroundRole( QPalette::Background );

  connect( m_pcWindowHandle, SIGNAL( windowActivated() ), this, SLOT( update() ) );
  connect( m_pcWindowHandle, SIGNAL( changed() ), this, SLOT( update() ) );
  connect( m_appModuleVideo, SIGNAL( changed() ), this, SLOT( update() ) );
  connect( m_appModuleQuality, SIGNAL( changed() ), this, SLOT( update() ) );
  connect( m_appModuleExtensions, SIGNAL( changed() ), this, SLOT( update() ) );

}
示例#19
0
VCWidget::VCWidget(QWidget* parent, Doc* doc)
    : QWidget(parent)
    , m_doc(doc)
    , m_id(invalidId())
    , m_disableState(false)
    , m_page(0)
    , m_allowChildren(false)
    , m_allowResize(true)
    , m_intensity(1.0)
    , m_liveEdit(VirtualConsole::instance()->liveEdit())
{
    Q_ASSERT(parent != NULL);
    Q_ASSERT(doc != NULL);

    /* Set the class name "VCWidget" as the object name as well */
    setObjectName(VCWidget::staticMetaObject.className());

    setMinimumSize(QSize(20, 20));

    m_type = UnknownWidget;
    m_hasCustomBackgroundColor = false;
    m_hasCustomForegroundColor = false;
    m_backgroundImage = QString();
    m_hasCustomFont = false;
    m_frameStyle = KVCFrameStyleNone;

    m_resizeMode = false;

    setBackgroundRole(QPalette::Window);
    setAutoFillBackground(true);
    setEnabled(true);

    connect(m_doc, SIGNAL(modeChanged(Doc::Mode)),
            this, SLOT(slotModeChanged(Doc::Mode)));

    /* Listen to parent's (only VCWidget-kind) key signals */
    if (parent->inherits(metaObject()->className()) == true)
    {
        connect(parent, SIGNAL(keyPressed(const QKeySequence&)),
                this, SLOT(slotKeyPressed(const QKeySequence&)));
        connect(parent,	SIGNAL(keyReleased(const QKeySequence&)),
                this, SLOT(slotKeyReleased(const QKeySequence&)));
    }
示例#20
0
toResultDataSingle::toResultDataSingle(QWidget *parent)
    : QWidget(parent)
    , Row(-1)
    , Container(NULL)
    , Model(NULL)
{
    setBackgroundRole(QPalette::Window);

    // fscking qscrollarea won't resize this is added
    QVBoxLayout *h = new QVBoxLayout;
    h->setContentsMargins(0, 0, 0, 0);
    h->setSpacing(0);
    ProgressBar = new QProgressBar(this);
    ProgressBar->setFormat("%v / %m");
    h->addWidget(ProgressBar);
    setLayout(h);

    setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
}
示例#21
0
TabPreview::TabPreview(BrowserWindow* window, QWidget* parent)
    : QFrame(parent)
    , m_window(window)
    , m_previewIndex(-1)
    , m_animationsEnabled(true)
    , m_stepX(0)
    , m_stepY(0)
    , m_stepWidth(0)
    , m_stepHeight(0)
{
    m_pixmapLabel = new QLabel(this);
    m_pixmapLabel->setAlignment(Qt::AlignHCenter);

    m_title = new QLabel(this);
    m_title->setAlignment(Qt::AlignHCenter);
    m_title->setWordWrap(true);

    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->addWidget(m_pixmapLabel);
    layout->addWidget(m_title);
    layout->setMargin(0);
    layout->setAlignment(Qt::AlignCenter);
    setLayout(layout);

    setBackgroundRole(QPalette::ToolTipBase);
    setForegroundRole(QPalette::ToolTipText);

    setContentsMargins(5, 5, 5, 5);
    setMaximumWidth(250);
    setMaximumHeight(170);

#ifdef ENABLE_OPACITY_EFFECT
    setGraphicsEffect(&m_opacityEffect);
    m_opacityEffect.setOpacity(0.0);
    connect(&m_opacityTimeLine, SIGNAL(frameChanged(int)), this, SLOT(setOpacity(int)));
#endif

    m_animation.setDuration(400);
    m_animation.setFrameRange(0, 100);
    m_animation.setUpdateInterval(20); // 50 fps
    connect(&m_animation, SIGNAL(frameChanged(int)), this, SLOT(setAnimationFrame(int)));
}
示例#22
0
void ImageNavigator::initialize() {
    setWindowFlags(Qt::Window | windowFlags());
    setAttribute(Qt::WA_DeleteOnClose);

    QRect screenRect = QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen());
    screenWidth = screenRect.width();
    screenHeight = screenRect.height();
    // qDebug() << "Screen Dimensions are " << screenWidth << " x " << screenHeight << endl;

    initializeTools();
    initializeActions();

    setBackgroundRole(QPalette::Dark);
    setForegroundRole(QPalette::Dark);
    navOrigin = QPoint(0, 0);
    scrollSpeed = 150;
    scrollBorder = 100;
    horizontalScrollBar()->setRange(0, 200);
    verticalScrollBar()->setRange(0, 200);
    horScroll = 0;
    verScroll = 0;
    imageScale = 1.0;
    //  maximumValueSearchRange=10;
    //  sigma = 3.0;
    //  maxSearchMethod = mrcImage::maximum_value;

    spotSelectMode = false;
    latticeRefinementMode = false;
    createPathMode = false;
    ctfView = false;
    viewDisplayParameters = false;
    fftSelectionMode = false;
    viewport()->setMouseTracking(true);
    connect(menu, SIGNAL(aboutToShow()), this, SLOT(openMenu()));

    if (imageType != "fft")
        image->setVisible("realOverlay", true);

    resize(1024, 768);
    showMaximized();
    //showFullScreen();
}
示例#23
0
QgsFileWidget::QgsFileWidget( QWidget *parent )
    : QWidget( parent )
    , mFilePath( QString() )
    , mButtonVisible( true )
    , mUseLink( false )
    , mFullUrl( false )
    , mDialogTitle( QString() )
    , mFilter( QString() )
    , mDefaultRoot( QString() )
    , mStorageMode( GetFile )
    , mRelativeStorage( Absolute )
{
  setBackgroundRole( QPalette::Window );
  setAutoFillBackground( true );

  QGridLayout* layout = new QGridLayout();
  layout->setMargin( 0 );

  // If displaying a hyperlink, use a QLabel
  mLinkLabel = new QLabel( this );
  // Make Qt opens the link with the OS defined viewer
  mLinkLabel->setOpenExternalLinks( true );
  // Label should always be enabled to be able to open
  // the link on read only mode.
  mLinkLabel->setEnabled( true );
  mLinkLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
  mLinkLabel->setTextFormat( Qt::RichText );
  layout->addWidget( mLinkLabel, 0, 0 );
  mLinkLabel->hide(); // do not show by default

  // otherwise, use the traditional QLineEdit
  mLineEdit = new QgsFilterLineEdit( this );
  connect( mLineEdit, SIGNAL( textEdited( QString ) ), this, SLOT( textEdited( QString ) ) );
  layout->addWidget( mLineEdit, 1, 0 );

  mFileWidgetButton = new QToolButton( this );
  mFileWidgetButton->setText( "..." );
  connect( mFileWidgetButton, SIGNAL( clicked() ), this, SLOT( openFileDialog() ) );
  layout->addWidget( mFileWidgetButton, 0, 1, 2, 1 );

  setLayout( layout );
}
示例#24
0
void BarAnalyzer::init()
{
    const double MAX_AMPLITUDE = 1.0;
    const double F = double(height() - 2) / (log10( static_cast<double>(255) ) * MAX_AMPLITUDE );

    setBackgroundRole( m_bg );

    BAND_COUNT = width() / 5;
    MAX_DOWN = int(0 -((height() / 50)));
    MAX_UP = int((height() / 25));

    debug() << "BAND_COUNT = " << BAND_COUNT << " MAX_UP = " << MAX_UP << "MAX_DOWN = " << MAX_DOWN;

    barVector.resize( BAND_COUNT, 0 );
    roofVector.resize( BAND_COUNT, height() -5 );
    roofVelocityVector.resize( BAND_COUNT, ROOF_VELOCITY_REDUCTION_FACTOR );
    m_roofMem.resize(BAND_COUNT);
    m_scope.resize(BAND_COUNT);

    //generate a list of values that express amplitudes in range 0-MAX_AMP as ints from 0-height() on log scale
    for ( uint x = 0; x < 256; ++x )
    {
        m_lvlMapper[x] = static_cast<uint>( ( F * log10( static_cast<float>(x+1) ) ) );
    }

    m_pixBarGradient = QPixmap( height()*COLUMN_WIDTH, height() );

    QPainter p( &m_pixBarGradient );
    for ( int x=0, r=0x40, g=0x30, b=0xff, r2=255-r; x < height(); ++x )
    {
        for ( int y = x; y > 0; --y )
        {
            const double fraction = (double)y / height();

//          p.setPen( QColor( r + (int)(r2 * fraction), g, b - (int)(255 * fraction) ) );
            p.setPen( QColor( r + (int)(r2 * fraction), g, b ) );
            p.drawLine( x*COLUMN_WIDTH, height() - y, (x+1)*COLUMN_WIDTH, height() - y );
        }
    }

    setMinimumSize( QSize( BAND_COUNT * COLUMN_WIDTH, 10 ) );
}
示例#25
0
CheckersPicture::CheckersPicture(QWidget *parent) : QWidget(parent)
{
    QPalette pal = palette();
    pal.setColor(QPalette::Light,QColor(0x4c,0x7a,0x79, 200));
    setPalette(pal);
    setBackgroundRole(QPalette::Light);
    setAutoFillBackground(true);

    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    setAttribute(Qt::WA_StaticContents);

    zoom = 16;
    curstate = NULL;
    n = 8;
    hourglass=QImage(":/icons/hourglass.png");
    setMinimumSize(zoom*(n+1),zoom*(n+1));
    showHourglass = true;

    thinking = false;
}
示例#26
0
Plotter::Plotter(QWidget *parent)
: QWidget(parent)
{
    setBackgroundRole(QPalette::Shadow);
setAutoFillBackground(true);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setFocusPolicy(Qt::StrongFocus);
rubberBandIsShown = false;
zoomInButton = new QToolButton(this);
zoomInButton->setIcon(QIcon(":/images/zoomin.png"));
//zoomInButton->setText("+");
zoomInButton->adjustSize();
connect(zoomInButton, SIGNAL(clicked()), this, SLOT(zoomIn()));
zoomOutButton = new QToolButton(this);
zoomOutButton->setIcon(QIcon(":/images/zoomout.png"));
//zoomOutButton->setText("-");
zoomOutButton->adjustSize();
connect(zoomOutButton, SIGNAL(clicked()), this, SLOT(zoomOut()));
setPlotSettings(PlotSettings());
}
示例#27
0
DItemToolTip::DItemToolTip(QWidget* const parent)
    : QLabel(parent, Qt::ToolTip), d(new Private)
{
    hide();

    setBackgroundRole(QPalette::ToolTipBase);
    setPalette(QToolTip::palette());
    ensurePolished();
    setMargin(qMax(d->tipBorder, 1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this)));
    setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
    setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);

    setFrameStyle(QFrame::StyledPanel);
/*
    Old-style box:
    setFrameStyle(QFrame::Plain | QFrame::Box);
    setLineWidth(1);
*/
    renderArrows();
}
示例#28
0
  SensorWidget(SensorView& sensorView, RobotConsole &c, QHeaderView* headerView, QWidget* parent) : 
    console(c), sensorView(sensorView), headerView(headerView), noPen(Qt::NoPen)
  {
    setBackgroundRole(QPalette::Base);
    const QFontMetrics& fontMetrics(QApplication::fontMetrics());
    lineSpacing = fontMetrics.lineSpacing() + 2;
    textOffset = fontMetrics.descent() + 1;

    font = QApplication::font();
    
    const QPalette& pal(QApplication::palette());
    altBrush = pal.alternateBase();
    fontPen.setColor(pal.text().color());
    
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    for(int j = 0; j < 2; ++j)
      for(int i = 0; i < SensorData::numOfUsSensorTypes; ++i)
        usDistances[j][i] = SensorData::off;
  }
示例#29
0
plotter::plotter(QWidget *parent)
    : QWidget(parent)
{
    setBackgroundRole(QPalette::Dark);
    setAutoFillBackground(true);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    setFocusPolicy(Qt::StrongFocus);
    rubberBandIsShown = false;

    zoomInButton = new QToolButton(this);
    zoomInButton->adjustSize();
    connect(zoomInButton,SIGNAL(clicked()), this, SLOT(zoomIn()));

    zoomOutButton = new QToolButton(this);
    zoomOutButton->adjustSize();
    connect(zoomOutButton,SIGNAL(clicked()), this, SLOT(zoomOut()));

    setPlotSettings(PlotSettings());

}
示例#30
0
void DropArea::dropEvent(QDropEvent *event)
{
    const QMimeData *mimeData = event->mimeData();

    QString text1;
    QList<QUrl> urlList = mimeData->urls();
    for (int i = 0; i < urlList.size() && i < 32; ++i)
        text1.append(urlList.at(i).toString() + QLatin1Char(' '));
    /*!
    \brief File adress is attached to the text.
    */
    char direccionEntradaTemp [1024];
    char direccionEntrada [1024];
    strcpy(direccionEntradaTemp, text1.toStdString().c_str() );
    /*!
    \brief Then it is converted to a c String so the Huffman.cpp can process it correctly, when given to it.
    */
    size_t i;
    for( i = 7; i < text1.toStdString().length() - 1; i++ )
    {
        direccionEntrada[i-7] = direccionEntradaTemp[i];
    }
    direccionEntrada[i-7] = '\0';
    /*!
    \brief Before accepting a compression, the Adress is checked to be valid.
    */
    if( isValid(direccionEntrada) )
    {
        text1 =direccionEntrada;
        Huffman huffmanCom;
        huffmanCom.start(direccionEntrada);
    }else
    {
        text1 ="Data extension is invalid";
    }

    setText( text1 );
    setTextFormat(Qt::PlainText);
    setBackgroundRole(QPalette::Dark);
    event->acceptProposedAction();
}