コード例 #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    fileDialog = new QFileDialog(this);
    setupLayout();
    setupMenuBar();
}
コード例 #2
0
ファイル: FontQt.cpp プロジェクト: Fale/qtmoko
int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool includePartialGlyphs) const
{
    QString string = qstring(run);
    QTextLayout layout(string, font());
    QTextLine line = setupLayout(&layout, run);
    return line.xToCursor(position);
}
コード例 #3
0
ファイル: SettingsTabImpl.cpp プロジェクト: johnbolia/schat
ProfilePage::ProfilePage(QWidget *parent)
  : SettingsPage(SCHAT_ICON(Profile), LS("profile"), parent)
{
  m_profileLabel = new QLabel(this);
  m_nickLabel = new QLabel(this);
  m_nickEdit = new NickEdit(this);

  m_genderLabel = new QLabel(this);
  m_genderField = new GenderField(this);

  m_layout = new ProfileLayout(this);

  QGridLayout *profileLay = new QGridLayout();
  profileLay->addWidget(m_nickLabel, 0, 0);
  profileLay->addWidget(m_nickEdit, 0, 1, 1, 2);
  profileLay->addWidget(m_genderLabel, 1, 0);
  profileLay->addWidget(m_genderField, 1, 1);
  profileLay->addWidget(m_layout->button(), 1, 2);
  profileLay->setContentsMargins(10, 0, 3, 0);

  m_mainLayout = new QVBoxLayout();
  m_mainLayout->addWidget(m_profileLabel);
  m_mainLayout->addLayout(profileLay);
  m_mainLayout->addWidget(m_layout);

  setupLayout();
  retranslateUi();
}
コード例 #4
0
ファイル: busdefgroup.cpp プロジェクト: kammoh/kactus2
//-----------------------------------------------------------------------------
// Function: BusDefGroup::BusDefGroup()
//-----------------------------------------------------------------------------
BusDefGroup::BusDefGroup(QWidget *parent):
    QGroupBox(tr("General (Bus Definition)"), parent),
    busDef_(),
    directConnection_(tr("Allow direct master-slave connection"), this),
    isAddressable_(tr("Addressable bus"), this),
    maxMasters_(this),
    maxSlaves_(this),
    descriptionEditor_(this)
{
    QRegExp regExp(QString("[0-9]*"), Qt::CaseInsensitive, QRegExp::W3CXmlSchema11);
    QRegExpValidator* validator = new QRegExpValidator(regExp, this);
    maxMasters_.setValidator(validator);
    maxSlaves_.setValidator(validator);

    maxMasters_.setPlaceholderText(tr("unbound"));
    maxSlaves_.setPlaceholderText(tr("unbound"));

    setupLayout();

    connect(&maxMasters_, SIGNAL(editingFinished()), this, SLOT(onMastersChanged()), Qt::UniqueConnection);
    connect(&maxSlaves_, SIGNAL(editingFinished()),	this, SLOT(onSlavesChanged()), Qt::UniqueConnection);

    connect(&directConnection_, SIGNAL(toggled(bool)),
            this, SLOT(onDirectConnectionChanged(bool)), Qt::UniqueConnection);
    connect(&isAddressable_, SIGNAL(toggled(bool)),
            this, SLOT(onIsAddressableChanged(bool)), Qt::UniqueConnection);

    connect(&descriptionEditor_, SIGNAL(textChanged()), this, SLOT(onDescriptionChanged()), Qt::UniqueConnection);
}
コード例 #5
0
SetupWizardDialog::SetupWizardDialog(wxWindow* parent) : wxDialog(parent, -1, "First Time SLADE Setup", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
{
	// Create pages
	pages.push_back(new TempFolderWizardPage(this));
	pages.push_back(new BaseResourceWizardPage(this));
	pages.push_back(new NodeBuildersWizardPage(this));
	current_page = 0;

	// Hide all pages
	for (unsigned a = 0; a < pages.size(); a++)
		pages[a]->Show(false);

	// Init layout
	setupLayout();

	// Set icon
	wxIcon icon;
	icon.CopyFromBitmap(getIcon("i_logo"));
	SetIcon(icon);

	// Setup layout
	SetInitialSize(wxSize(600, 500));
	Layout();
	Fit();
	SetMinSize(GetBestSize());
	CenterOnParent();

	showPage(0);

	// Bind events
	btn_next->Bind(wxEVT_BUTTON, &SetupWizardDialog::onBtnNext, this);
	btn_prev->Bind(wxEVT_BUTTON, &SetupWizardDialog::onBtnPrev, this);
}
コード例 #6
0
void EmergingPlasmoid::init() {
  gentooLogoLabel.setAlignment(Qt::AlignCenter | Qt::AlignHCenter);
  gentooLogoLabel.setOpacity(0.7f);

  currentJobMeter.setMeterType(Plasma::Meter::BarMeterHorizontal);
  currentJobMeter.setMaximum(100);
  currentJobMeter.setMaximumHeight(40.0f);
  currentJobMeter.setMinimumHeight(40.0f);
  currentJobMeter.setLabelAlignment(0, Qt::AlignJustify | Qt::AlignVCenter);
  currentJobMeter.setLabelAlignment(1, Qt::AlignRight | Qt::AlignVCenter);
  currentJobMeter.setLabelAlignment(2, Qt::AlignRight | Qt::AlignVCenter);


  totalJobMeter.setMeterType(Plasma::Meter::BarMeterHorizontal);
  totalJobMeter.setMaximum(100);
  totalJobMeter.setMaximumHeight(40.0f);
  totalJobMeter.setMinimumHeight(40.0f);
  totalJobMeter.setLabelAlignment(0, Qt::AlignJustify | Qt::AlignVCenter);
  totalJobMeter.setLabelAlignment(1, Qt::AlignRight | Qt::AlignVCenter);
  totalJobMeter.setLabelAlignment(2, Qt::AlignRight | Qt::AlignVCenter);

  KConfigGroup conf = config();
  timeout = conf.readEntry("timeout", 10);
  logoPosition =(LogoPosition) conf.readEntry("logoPosition", (int)LogoInTop);

  layout = new QGraphicsGridLayout(this);
  setupLayout();
  
  clear();
}
コード例 #7
0
int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool) const
{
    const QString string = fixSpacing(qstring(run));
    QTextLayout layout(string, font());
    QTextLine line = setupLayout(&layout, run);
    return line.xToCursor(position);
}
コード例 #8
0
SettingsWidget::SettingsWidget(QWidget *parent):
    QWidget( parent )
{
    setupComponents();
    setupActions();
    setupLayout();
}
コード例 #9
0
// -----------------------------------------------------------------------------
// GraphicsPrefsPanel class constructor
// -----------------------------------------------------------------------------
GraphicsPrefsPanel::GraphicsPrefsPanel(wxWindow* parent) : PrefsPanelBase(parent)
{
	// Create controls
	auto cp_flags   = wxCLRP_SHOW_LABEL | wxCLRP_USE_TEXTCTRL;
	cp_colour1_     = new wxColourPickerCtrl(this, -1, *wxBLACK, wxDefaultPosition, wxDefaultSize, cp_flags);
	cp_colour2_     = new wxColourPickerCtrl(this, -1, *wxBLACK, wxDefaultPosition, wxDefaultSize, cp_flags);
	choice_presets_ = new wxChoice(this, -1);
	choice_presets_->Append(WxUtils::arrayString({ "Default",
												   "Black",
												   "Black (Checkered)",
												   "Cyan",
												   "Cyan (Checkered)",
												   "Magenta",
												   "Magenta (Checkered)",
												   "White",
												   "White (Checkered)",
												   "Yellow",
												   "Yellow (Checkered)",
												   "Vintage Id Software" }));
	choice_browser_bg_ = new wxChoice(this, -1);
	choice_browser_bg_->Append(
		WxUtils::arrayString({ "Transparent background (as above)", "System background", "Black background" }));
	cb_show_border_       = new wxCheckBox(this, -1, "Show outline around graphics and textures");
	cb_hilight_mouseover_ = new wxCheckBox(this, -1, "Hilight graphics on mouse hover");
	cb_extra_gfxconv_     = new wxCheckBox(this, -1, "Offer additional conversion options");

	setupLayout();

	// Bind events
	choice_presets_->Bind(wxEVT_CHOICE, &GraphicsPrefsPanel::onChoicePresetSelected, this);
}
コード例 #10
0
ファイル: absdefgroup.cpp プロジェクト: kammoh/kactus2
//-----------------------------------------------------------------------------
// Function: AbsDefGroup::AbsDefGroup()
//-----------------------------------------------------------------------------
AbsDefGroup::AbsDefGroup(LibraryInterface* handler, QWidget *parent): 
QGroupBox(tr("Signals (Abstraction Definition)"), parent),
portView_(this),
portModel_(this),
handler_(handler),
absDef_()
{
	portView_.setModel(&portModel_);
	portView_.setItemDelegate(new BusPortsDelegate(this));
    portView_.setAllowImportExport(true);
    portView_.setItemsDraggable(false);

	connect(&portView_, SIGNAL(addSignalOptions()), this, SLOT(onAddSignalOptions()), Qt::UniqueConnection);
	
	connect(&portModel_, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
		this, SIGNAL(contentChanged()), Qt::UniqueConnection);
	connect(&portModel_, SIGNAL(contentChanged()),
		this, SIGNAL(contentChanged()), Qt::UniqueConnection);
	connect(&portModel_, SIGNAL(noticeMessage(const QString&)),
		this, SIGNAL(noticeMessage(const QString&)), Qt::UniqueConnection);
	connect(&portModel_, SIGNAL(errorMessage(const QString&)),
		this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection);
    connect(&portModel_, SIGNAL(portRenamed(const QString&, const QString&)), 
        this, SIGNAL(portRenamed(const QString&, const QString&)), Qt::UniqueConnection);
    connect(&portModel_, SIGNAL(portRemoved(const QString&, const General::InterfaceMode)), 
        this, SIGNAL(portRemoved(const QString&, const General::InterfaceMode)), Qt::UniqueConnection);

    connect(&portView_, SIGNAL(addItem(const QModelIndex&)),
        &portModel_, SLOT(addSignal()), Qt::UniqueConnection);
    connect(&portView_, SIGNAL(removeItem(const QModelIndex&)),
        &portModel_, SLOT(onRemoveItem(const QModelIndex&)), Qt::UniqueConnection);

	setupLayout();
}
コード例 #11
0
/**
 * Constructor.
 * @param cam
 * @param parent
 */
CameraCalibrationEvaluation::CameraCalibrationEvaluation(scc::CameraCalibration *cam,
                                                         QWidget *parent) :
    QWidget(parent) {
    qDebug() << "CameraCalibrationEvaluation(QTabWidget *parent):";
    cameraCalibration = cam;
    setupLayout();
}
コード例 #12
0
ファイル: MainWindow.cpp プロジェクト: doomtech/slade
/* MainWindow::MainWindow
 * MainWindow class constructor
 *******************************************************************/
MainWindow::MainWindow()
: STopWindow("SLADE", mw_left, mw_top, mw_width, mw_height) {
	lasttipindex = 0;
	custom_menus_begin = 2;
	if (mw_maximized) Maximize();
	setupLayout();
	SetDropTarget(new MainWindowDropTarget());
}
コード例 #13
0
ファイル: addressspaceeditor.cpp プロジェクト: kammoh/kactus2
//-----------------------------------------------------------------------------
// Function: AddressSpaceEditor::AddressSpaceEditor()
//-----------------------------------------------------------------------------
AddressSpaceEditor::AddressSpaceEditor(QSharedPointer<Component> component, 
    LibraryInterface* handler,
    QSharedPointer<AddressSpace> addrSpace,
    QSharedPointer <ParameterFinder> parameterFinder,
    QSharedPointer <ExpressionFormatter> expressionFormatter,
    QSharedPointer<ExpressionParser> expressionParser,
    QWidget* parent):
ItemEditor(component, handler, parent),
    addrSpace_(addrSpace),
    nameEditor_(addrSpace->getNameGroup(), this),
    generalEditor_(addrSpace, component->getMasterInterfaces(addrSpace_->getName()), parameterFinder,
                   expressionParser, this),
    segmentsEditor_(addrSpace, component, handler->getDirectoryPath(*component->getVlnv()), parameterFinder,
                    expressionParser, expressionFormatter, this),
    localMemMapEditor_(addrSpace->getLocalMemoryMap(), component, handler, parameterFinder, expressionFormatter, 
                       this)
{
	Q_ASSERT(addrSpace_);

    nameEditor_.setTitle(tr("Address space name and description"));

    connect(&nameEditor_, SIGNAL(contentChanged()),	this, SIGNAL(contentChanged()), Qt::UniqueConnection);

    connect(&generalEditor_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&generalEditor_, SIGNAL(graphicsChanged()), this, SIGNAL(graphicsChanged()), Qt::UniqueConnection);

    connect(&generalEditor_, SIGNAL(increaseReferences(QString)),
        this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
    connect(&generalEditor_, SIGNAL(decreaseReferences(QString)),
        this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);

    connect(&segmentsEditor_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&segmentsEditor_, SIGNAL(contentChanged()), this, SIGNAL(graphicsChanged()), Qt::UniqueConnection);

    connect(&segmentsEditor_, SIGNAL(errorMessage(const QString&)),
        this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection);
    connect(&segmentsEditor_, SIGNAL(noticeMessage(const QString&)),
        this, SIGNAL(noticeMessage(const QString&)), Qt::UniqueConnection);

	connect(&localMemMapEditor_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&localMemMapEditor_, SIGNAL(graphicsChanged()), this, SIGNAL(graphicsChanged()), Qt::UniqueConnection);
    connect(&localMemMapEditor_, SIGNAL(errorMessage(const QString&)),
        this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection);
	connect(&localMemMapEditor_, SIGNAL(itemAdded(int)),
		this, SIGNAL(childAdded(int)), Qt::UniqueConnection);
	connect(&localMemMapEditor_, SIGNAL(itemRemoved(int)),
		this, SIGNAL(childRemoved(int)), Qt::UniqueConnection);

    connect(&localMemMapEditor_, SIGNAL(increaseReferences(QString)),
        this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
    connect(&localMemMapEditor_, SIGNAL(decreaseReferences(QString)),
        this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);

    setupLayout();

	refresh();
}
コード例 #14
0
//-----------------------------------------------------------------------------
// Function: ComponentEditorSettingsPage::ComponentEditorSettingsPage()
//-----------------------------------------------------------------------------
ComponentEditorSettingsPage::ComponentEditorSettingsPage(QSettings &settings) : 
SettingsPage(settings),
workspaceHwCheckBoxes_(),
workspaceSwCheckBoxes_(),
currentWorkspaceIndex_(0)
{
	loadSettings();
	setupLayout();
}
コード例 #15
0
ファイル: debugpreferences.cpp プロジェクト: nctan/quneiform
DebugPreferences::DebugPreferences(QWidget * parent) :
    PreferencesWidget(parent),
    layout_(NULL)
{
    setTitle(tr("Debug"));
    setIcon(iconFromTheme("tools-report-bug"));
    setupLayout();
    setupUI();
}
コード例 #16
0
ファイル: FontQt.cpp プロジェクト: akosicki/phantomjs
int Font::offsetForPositionForComplexText(const TextRun& run, float position, bool) const
{
    String sanitized = Font::normalizeSpaces(run.characters(), run.length());
    QString string = fromRawDataWithoutRef(sanitized);

    QTextLayout layout(string, font());
    QTextLine line = setupLayout(&layout, run);
    return line.xToCursor(position);
}
コード例 #17
0
ファイル: GfxConvDialog.cpp プロジェクト: alexey-lysiuk/SLADE
// -----------------------------------------------------------------------------
// GfxConvDialog class constructor
// -----------------------------------------------------------------------------
GfxConvDialog::GfxConvDialog(wxWindow* parent) : SDialog(parent, "Graphic Format Conversion", "gfxconv")
{
	// Set dialog icon
	wxIcon icon;
	icon.CopyFromBitmap(Icons::getIcon(Icons::General, "convert"));
	SetIcon(icon);

	setupLayout();
	CenterOnParent();
}
コード例 #18
0
PlottingWidget::PlottingWidget(QWidget *parent):
    QWidget( parent )
{
    recordingTime = 0;
    nFrames = 0;
    currentFrame = 0;

    setupComponents();
    setupActions();
    setupLayout();
}
コード例 #19
0
ファイル: NewBusDialog.cpp プロジェクト: kammoh/kactus2
//-----------------------------------------------------------------------------
// Function: NewBusDialog::NewBusDialog()
//-----------------------------------------------------------------------------
NewBusDialog::NewBusDialog(LibraryInterface* handler, QWidget* parent) :
NewObjectDialog(handler, VLNV::BUSDEFINITION , false, parent),
nameSelection_(tr("Name"), this),
descriptionSelection_(tr("Description"), this)
{         
    setWindowTitle(tr("New bus interface"));  

    setupLayout();
    setFixedHeight(sizeHint().height());
    resize(400, sizeHint().height());
}
コード例 #20
0
ファイル: MainWindow.cpp プロジェクト: sirjuddington/SLADE
// -----------------------------------------------------------------------------
// MainWindow class constructor
// -----------------------------------------------------------------------------
MainWindow::MainWindow() : STopWindow("SLADE", "main")
{
	custom_menus_begin_ = 2;

	if (mw_maximized)
		wxTopLevelWindow::Maximize();

	setupLayout();

	wxWindow::SetDropTarget(new MainWindowDropTarget());
}
コード例 #21
0
/*!
    Constructs a VkOptionsDialog
*/
VkOptionsDialog::VkOptionsDialog( QWidget* parent )
   : QDialog( parent )
{
   // ------------------------------------------------------------
   // basic dialog setup
   setObjectName( QString::fromUtf8( "VkOptionsDialog" ) );
   setWindowTitle( "[*]Valkyrie Options Dialog" ); // [*] == 'windowModified' placeholder
   setupLayout();
   
   // ------------------------------------------------------------
   // Add categories, and the pages
   // Note: both the pages and categories list use the same 'index',
   // which is how we keep them in sync.
   // TODO: if any complaints re speed, load the pages on demand.
   VkObjectList objList = (( MainWindow* )parent )->getValkyrie()->vkObjList();
   
   for ( int i = 0; i < objList.size(); ++i ) {
   
      // Allow the VkObject to create the appropriate options page
      // Pass 'this' so constructor widgets auto-size correctly.
      VkObject* obj = objList.at( i );
      VkOptionsPage* page = obj->createVkOptionsPage();
      vk_assert( page != 0 );
      page->init();
      connect( page, SIGNAL( modified() ), this, SLOT( pageModified() ) );
      // handle e.g. user pressing return in an ledit
      connect( page, SIGNAL( apply() ), this, SLOT( apply() ) );
      
      // Set list item entry
      QListWidgetItem* item = new QListWidgetItem( contentsListWidget );
      QString itemName = obj->objectName();
      itemName[0] = itemName[0].toUpper();
      item->setText( itemName );

      QFont font = item->font();
      font.setBold( true );
      font.setPointSize( font.pointSize() * 1.2 );
      item->setFont( font );

      // insert into stack (takes ownership)
      optionPages->addWidget( page );
   }
   
   contentsListWidget->setCurrentRow( 0 );
   contentsListWidget->setFocus();
   optionPages->setCurrentIndex( 0 );
   
   // Give a max to our contentsList, based on hints from the list-items.
   // TODO: surely this can be done automatically?
   // - QSizePolicy::* don't seem to do the job :-(
   contentsListWidget->setMaximumWidth( 40 + contentsListWidget->sizeHintForColumn( 0 ) );
   
   ContextHelp::addHelp( this, urlValkyrie::optsDlg );
}
コード例 #22
0
void EmergingPlasmoid::configAccepted() {
  timeout = configWidget.timeoutSpinBox->value();
  logoPosition = (LogoPosition) configWidget.logoPositionComboBox->currentIndex();
  KConfigGroup conf = config();
  conf.writeEntry("timeout", timeout);
  conf.writeEntry("logoPosition", (int) logoPosition);
  conf.sync();
  
  setupLayout();
  configDialog->enableButtonApply(false);
  emit configNeedsSaving();
}
コード例 #23
0
ファイル: MainWindow.cpp プロジェクト: SanyaWaffles/SLADE
/* MainWindow::MainWindow
 * MainWindow class constructor
 *******************************************************************/
MainWindow::MainWindow()
	: STopWindow("SLADE", "main")
{
	lasttipindex = 0;
	custom_menus_begin = 2;
	if (mw_maximized) Maximize();
	setupLayout();
	SetDropTarget(new MainWindowDropTarget());
#ifdef USE_WEBVIEW_STARTPAGE
	docs_page = NULL;
#endif
}
コード例 #24
0
FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const
{
    const QString string = fixSpacing(qstring(run));
    QTextLayout layout(string, font());
    QTextLine line = setupLayout(&layout, run);

    float x1 = line.cursorToX(from);
    float x2 = line.cursorToX(to);
    if (x2 < x1)
        qSwap(x1, x2);

    return FloatRect(pt.x() + x1, pt.y(), x2 - x1, h);
}
コード例 #25
0
ファイル: GfxConvDialog.cpp プロジェクト: jonrimmer/SLADE
/* GfxConvDialog::GfxConvDialog
 * GfxConvDialog class constructor
 *******************************************************************/
GfxConvDialog::GfxConvDialog(wxWindow* parent)
: SDialog(parent, "Graphic Format Conversion", "gfxconv")
{
	current_item = 0;

	// Set dialog icon
	wxIcon icon;
	icon.CopyFromBitmap(getIcon("t_convert"));
	SetIcon(icon);

	setupLayout();
	CenterOnParent();
}
コード例 #26
0
ファイル: mainwindow.cpp プロジェクト: airxcy/groupCorelate
MainWindow::MainWindow()
{

    cWidget = new QWidget(this,Qt::FramelessWindowHint);
    setCentralWidget(cWidget);

    streamThd = new StreamThread(this);

    trkscene=NULL;
    setupLayout();
    makeConns();
    move(100, 0);

}
コード例 #27
0
float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*) const
{
    if (!run.length())
        return 0;
    const QString string = fixSpacing(qstring(run));
    QTextLayout layout(string, font());
    QTextLine line = setupLayout(&layout, run);
    int w = int(line.naturalTextWidth());
    // WebKit expects us to ignore word spacing on the first character (as opposed to what Qt does)
    if (treatAsSpace(run[0]))
        w -= m_wordSpacing;

    return w + run.padding();
}
コード例 #28
0
    void drawToD2DContext (const AttributedString& text, const Rectangle<float>& area, ID2D1RenderTarget* const renderTarget,
                           IDWriteFactory* const directWriteFactory, IDWriteFontCollection* const fontCollection)
    {
        ComSmartPtr<IDWriteTextLayout> dwTextLayout;
        setupLayout (text, area.getWidth(), area.getHeight(), renderTarget, directWriteFactory,
                     fontCollection, dwTextLayout.resetAndGetPointerAddress());

        ComSmartPtr<ID2D1SolidColorBrush> d2dBrush;
        renderTarget->CreateSolidColorBrush (D2D1::ColorF (D2D1::ColorF (0.0f, 0.0f, 0.0f, 1.0f)),
                                             d2dBrush.resetAndGetPointerAddress());

        renderTarget->DrawTextLayout (D2D1::Point2F ((float) area.getX(), (float) area.getY()),
                                      dwTextLayout, d2dBrush, D2D1_DRAW_TEXT_OPTIONS_CLIP);
    }
コード例 #29
0
ファイル: FontQt.cpp プロジェクト: akosicki/phantomjs
FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const
{
    String sanitized = Font::normalizeSpaces(run.characters(), run.length());
    QString string = fromRawDataWithoutRef(sanitized);

    QTextLayout layout(string, font());
    QTextLine line = setupLayout(&layout, run);

    float x1 = line.cursorToX(from);
    float x2 = line.cursorToX(to);
    if (x2 < x1)
        qSwap(x1, x2);

    return FloatRect(pt.x() + x1, pt.y(), x2 - x1, h);
}
コード例 #30
0
ファイル: GLWindow.cpp プロジェクト: szte-wsn/szte-wsn
void GLWindow::init() {

    setAttribute(Qt::WA_DeleteOnClose);

    createSlider();

    createButton();

    createTimer();

    setupLayout();

    setupConnections();

    timerStart();
}