Ejemplo n.º 1
0
void LineGraph::setDataSource(LineGraphDataSource *dataSource)
{
    if (m_dataSource == dataSource)
        return;

    if(m_dataSource) {
        m_dataSource->disconnect(this);
    }

    m_dataSource = dataSource;
    connect(m_dataSource, SIGNAL(dataChanged()), this, SLOT(markDirty()));
    emit dataSourceChanged(dataSource);
}
Ejemplo n.º 2
0
MapTilesFrame::MapTilesFrame(QWidget *parent) :
    QFrame(parent),
    ui(new Ui::MapTilesFrame)
{
    ui->setupUi(this);

    connect(this, SIGNAL(movingStatusChanged(bool)),
            this, SLOT(updateMouseCursor(bool)));
    connect(this, SIGNAL(viewportCoordinateChanged(QPoint,QPoint)),
            this, SLOT(update()));
    connect(this, SIGNAL(scaleLevelChanged(const QPoint&,int,int)),
            this, SLOT(adjustViewportOnZoom(const QPoint&,int,int)));

    connect(&tileProvider, SIGNAL(mapTypeChanged(QString)), this, SLOT(update()));
    connect(&tileProvider, SIGNAL(dataSourceChanged(DataSource)), this, SLOT(update()));
    connect(&tileProvider, SIGNAL(serverAddressChanged(QString)), this, SLOT(update()));
    connect(&tileProvider, SIGNAL(tileFileTypeChanged(QString)), this, SLOT(update()));
    connect(&tileProvider, SIGNAL(readyTile(QString)), this, SLOT(update()));


//    connect(this, SIGNAL(scaleLevelChanged(QPoint,int,int)),
//            this,SLOT(setAppropriateSize()));

    //mapFilesPath = QCoreApplication::applicationDirPath() + "/map";

    tileWidth = 375;
    tileHeight = 250;

    for(int i = 1; i <= MAX_LEVEL; i++)
    {
        scaleMaps[i].width = 2 * i * tileWidth;
        scaleMaps[i].height = 2 * i * tileHeight;
    }

    biggerMapRect = new QImage();
    //biggerMapRect = QImage(9999, 9999, QImage::Format_RGB16);

    m_viewportCoordinate = QPoint(0,height());
    //setViewportCoordinate(QPoint(0,height()));
    setMoving(false);

    //先设置scaleLevel为一个不存在的值 0 ,然后调用zoomIn使视口放缩级别调整到到最小可视级别
    m_scaleLevel = 1;
    //zoomIn();

    setViewportCoordinate(QPoint(0,height()));

}
Ejemplo n.º 3
0
void DataClient::setDataSource(QQuickItem *item)
{
    auto* d = dynamic_cast<DataSource*>(item);
    if (d == m_source) {
        return;
    }

    // disconnect from previous data source
    if (m_source != nullptr) {
        disconnect(m_source, &DataSource::dataChanged, this, &DataClient::dataChanged);
    }
    // connect to new data source
    if (d != nullptr) {
        connect(d, &DataSource::dataChanged, this, &DataClient::dataChanged);
    }
    m_source = d;
    m_new_source = true;
    emit dataSourceChanged(d);
    update();
}
Ejemplo n.º 4
0
void DataWizardPageDataSource::sourceValid(QString filename, int requestID) {
  if (_requestID != requestID) {
    return;
  }
  _pageValid = true;
  _dataSource = DataSourcePluginManager::findOrLoadSource(_store, filename, true);
  connect(_dataSource, SIGNAL(progress(int,QString)), kstApp->mainWindow(), SLOT(updateProgress(int,QString)));
  _fileType->setText(_dataSource->fileType());  

  _dataSource->readLock();
  _configureSource->setEnabled(_dataSource->hasConfigWidget());
  _dataSource->unlock();

  {
    DataSourcePtr tmpds = _dataSource; // increase usage count
    _store->cleanUpDataSourceList();
  }

  updateUpdateBox();
  emit completeChanged();
  emit dataSourceChanged();
}
Ejemplo n.º 5
0
KexiDataSourcePage::KexiDataSourcePage(QWidget *parent)
        : KexiPropertyPaneViewBase(parent)
        , m_noDataSourceAvailableSingleText(
            i18n("No data source could be assigned for this widget.") )
        , m_noDataSourceAvailableMultiText(
            i18n("No data source could be assigned for multiple widgets.") )
        , m_insideClearFormDataSourceSelection(false)
#ifdef KEXI_NO_AUTOFIELD_WIDGET
        , m_tableOrQuerySchema(0)
#endif
{
/*moved
    Q3VBoxLayout *vlyr = new Q3VBoxLayout(this);
    m_objectInfoLabel = new KexiObjectInfoLabel(this);
    m_objectInfoLabel->setObjectName("KexiObjectInfoLabel");
    vlyr->addWidget(m_objectInfoLabel);*/
//moved    vlyr->addSpacing(8);

    //Section 1: Form's/Widget's Data Source
/*2.0    KoProperty::GroupContainer *container = new KoProperty::GroupContainer(
        i18n("Data Source"), this);
    layout()->addWidget(container);

    QWidget *contents = new QWidget(container);
    container->setContents(contents);*/
//2.0    QVBoxLayout *contentsVlyr = new QVBoxLayout(this);
//2.0    contentsVlyr->setContentsMargins(0, 0, 0, 0);

    infoLabel()->setContentsMargins(0, 0, 0, spacing());

    m_noDataSourceAvailableLabel = new QLabel(m_noDataSourceAvailableSingleText, this);
    m_noDataSourceAvailableLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
    m_noDataSourceAvailableLabel->setContentsMargins(0, 0, 0, spacing());
//m_noDataSourceAvailableLabel->setAutoFillBackground(true);
//m_noDataSourceAvailableLabel->setPaletteBackgroundColor(Qt::red);
//2.0    m_noDataSourceAvailableLabel->setMargin(2);
    m_noDataSourceAvailableLabel->setAlignment(Qt::AlignBottom | Qt::AlignLeft);
    m_noDataSourceAvailableLabel->setWordWrap(true);
    mainLayout()->addWidget(m_noDataSourceAvailableLabel);

    //-Widget's Data Source
    QHBoxLayout *hlyr = new QHBoxLayout();
    mainLayout()->addLayout(hlyr);
#if 0
//! @todo unhide this when expression work
// m_widgetDSLabel = new QLabel(i18nc("Table Field, Query Field or Expression", "Source field or expression"), this);
#else
    m_widgetDSLabel = new QLabel(
        i18nc("Table Field or Query Field", "Widget's data source"), this);
#endif
    m_widgetDSLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
//2.0    m_widgetDSLabel->setMargin(2);
//2.0    m_widgetDSLabel->setMinimumHeight(IconSize(KIconLoader::Small) + 4);
    m_widgetDSLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
    hlyr->addWidget(m_widgetDSLabel);

#if 0 //2.0: clear button is available in the combobox itself
    m_clearWidgetDSButton = new KexiSmallToolButton(
        koIcon("edit-clear-locationbar-rtl"), QString(), this);
    m_clearWidgetDSButton->setObjectName("clearWidgetDSButton");
    m_clearWidgetDSButton->setMinimumHeight(m_widgetDSLabel->minimumHeight());
    m_clearWidgetDSButton->setToolTip(i18n("Clear widget's data source"));
    hlyr->addWidget(m_clearWidgetDSButton);
    connect(m_clearWidgetDSButton, SIGNAL(clicked()),
            this, SLOT(clearWidgetDataSourceSelection()));
#endif

    m_widgetDataSourceCombo = new KexiFieldComboBox(this);
    m_widgetDataSourceCombo->setObjectName("sourceFieldCombo");
    m_widgetDataSourceCombo->setContentsMargins(0, 0, 0, 0);
    m_widgetDSLabel->setBuddy(m_widgetDataSourceCombo);
    connect(m_widgetDataSourceCombo->lineEdit(), SIGNAL(clearButtonClicked()),
        this, SLOT(clearWidgetDataSourceSelection()));
    mainLayout()->addWidget(m_widgetDataSourceCombo);
    
    m_widgetDataSourceComboSpacer = addWidgetSpacer();

    /* m_dataSourceSeparator = new Q3Frame(contents);
      m_dataSourceSeparator->setFrameShape(Q3Frame::HLine);
      m_dataSourceSeparator->setFrameShadow(Q3Frame::Sunken);
      mainLayout()->addWidget(m_dataSourceSeparator);*/

//    addSpacing();

    //- Form's Data Source
    hlyr = new QHBoxLayout();
    hlyr->setContentsMargins(0, 0, 0, 0);
    mainLayout()->addLayout(hlyr);
    m_dataSourceLabel = new QLabel(i18n("Form's data source"), this);
    m_dataSourceLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
//2.0    m_dataSourceLabel->setMargin(2);
//2.0    m_dataSourceLabel->setMinimumHeight(IconSize(KIconLoader::Small) + 4);
    m_dataSourceLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
    hlyr->addWidget(m_dataSourceLabel);

//m_dataSourceLabel->setAutoFillBackground(true);
//m_dataSourceLabel->setPaletteBackgroundColor(Qt::red);

    m_gotoButton = new KexiSmallToolButton(
        koIcon("go-jump"), QString(), this);
    m_gotoButton->setObjectName("gotoButton");
//2.0    m_gotoButton->setMinimumHeight(m_dataSourceLabel->minimumHeight());
    m_gotoButton->setToolTip(i18n("Go to selected form's data source"));
    m_gotoButton->setWhatsThis(i18n("Goes to selected form's data source"));
    hlyr->addWidget(m_gotoButton);
    connect(m_gotoButton, SIGNAL(clicked()), this, SLOT(slotGotoSelected()));

#if 0 //2.0: clear button is available in the combobox itself
    m_clearDSButton = new KexiSmallToolButton(
        koIcon("edit-clear-locationbar-rtl"), QString(), this);
    m_clearDSButton->setObjectName("clearDSButton");
    m_clearDSButton->setMinimumHeight(m_dataSourceLabel->minimumHeight());
    m_clearDSButton->setToolTip(i18n("Clear form's data source"));
    hlyr->addWidget(m_clearDSButton);
    connect(m_clearDSButton, SIGNAL(clicked()), this, SLOT(clearFormDataSourceSelection()));
#endif

    m_formDataSourceCombo = new KexiDataSourceComboBox(this);
    m_formDataSourceCombo->setObjectName("dataSourceCombo");
    m_formDataSourceCombo->setContentsMargins(0, 0, 0, 0);
    m_dataSourceLabel->setBuddy(m_formDataSourceCombo);
    connect(m_formDataSourceCombo->lineEdit(), SIGNAL(clearButtonClicked()),
        this, SLOT(clearFormDataSourceSelection()));
    mainLayout()->addWidget(m_formDataSourceCombo);

    m_formDataSourceComboSpacer = addWidgetSpacer();

#ifdef KEXI_NO_AUTOFIELD_WIDGET
    m_availableFieldsLabel = 0;
    m_addField = 0;
// m_fieldListView = 0;
    mainLayout()->addStretch();
#else
//    addSpacing();
    /* Q3Frame *separator = new QFrame(this);
      separator->setFrameShape(Q3Frame::HLine);
      separator->setFrameShadow(Q3Frame::Sunken);
      vlyr->addWidget(separator);*/
    /*
      KPopupTitle *title = new KPopupTitle(this);
      title->setTitle(i18n("Inserting fields"));
      vlyr->addWidget(title);
      vlyr->addSpacing(4);*/


    //2. Inserting fields
/*2.0    container = new KoProperty::GroupContainer(i18n("Inserting Fields"), this);
    static_cast<QBoxLayout*>(layout())->addWidget(container, 1);*/

    //helper info
//! @todo allow to hide such helpers by adding global option
//2.0    contents = new QWidget(container);
//2.0    container->setContents(contents);
//2.0    mainLayout() = new QVBoxLayout(contents);
    hlyr = new QHBoxLayout();
    hlyr->setContentsMargins(0, 0, 0, 0);
    mainLayout()->addLayout(hlyr);
    m_mousePointerLabel = new QLabel(this);
    hlyr->addWidget(m_mousePointerLabel);
    m_mousePointerLabel->setPixmap(koIcon("mouse_pointer"));
    m_mousePointerLabel->setFixedWidth(m_mousePointerLabel->pixmap()
                                       ? m_mousePointerLabel->pixmap()->width() : 0);
    m_availableFieldsDescriptionLabel = new QLabel(
        i18n("Select fields from the list below and drag them onto"
             " a form or click the \"Insert\" button"), this);
    m_availableFieldsDescriptionLabel->setAlignment(Qt::AlignLeft);
    m_availableFieldsDescriptionLabel->setWordWrap(true);
    hlyr->addWidget(m_availableFieldsDescriptionLabel);

    //Available Fields
//2.0    mainLayout()->addSpacing(4);
    hlyr = new QHBoxLayout();
    hlyr->setContentsMargins(0, 0, 0, 0);
    mainLayout()->addLayout(hlyr);
    m_availableFieldsLabel = new QLabel(i18n("Available fields"), this);
    m_availableFieldsLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
//2.0    m_availableFieldsLabel->setMargin(2);
//2.0    m_availableFieldsLabel->setMinimumHeight(IconSize(KIconLoader::Small));
    hlyr->addWidget(m_availableFieldsLabel);

    m_addField = new KexiSmallToolButton(
        koIcon("add_field"), i18nc("Insert selected field into form", "Insert"), this);
    m_addField->setObjectName("addFieldButton");
//2.0    m_addField->setMinimumHeight(m_availableFieldsLabel->minimumHeight());
// m_addField->setTextPosition(QToolButton::Right);
    m_addField->setFocusPolicy(Qt::StrongFocus);
    m_addField->setToolTip(i18n("Insert selected fields into form"));
    m_addField->setWhatsThis(i18n("Inserts selected fields into form"));
    hlyr->addWidget(m_addField);
    connect(m_addField, SIGNAL(clicked()), this, SLOT(slotInsertSelectedFields()));

    m_fieldListView = new KexiFieldListView(this,
        KexiFieldListView::ShowDataTypes | KexiFieldListView::AllowMultiSelection);
    m_fieldListView->setObjectName("fieldListView");
    m_fieldListView->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
    m_availableFieldsLabel->setBuddy(m_fieldListView);
    mainLayout()->addWidget(m_fieldListView, 1);
    connect(m_fieldListView, SIGNAL(selectionChanged()),
            this, SLOT(slotFieldListViewSelectionChanged()));
    connect(m_fieldListView,
            SIGNAL(fieldDoubleClicked(QString,QString,QString)),
            this, SLOT(slotFieldDoubleClicked(QString,QString,QString)));
#endif

    mainLayout()->addStretch(1);

    connect(m_formDataSourceCombo, SIGNAL(textChanged(QString)),
            this, SLOT(slotFormDataSourceTextChanged(QString)));
    connect(m_formDataSourceCombo, SIGNAL(dataSourceChanged()),
            this, SLOT(slotFormDataSourceChanged()));
    connect(m_widgetDataSourceCombo, SIGNAL(selected()),
            this, SLOT(slotFieldSelected()));

    clearFormDataSourceSelection();
    slotFieldListViewSelectionChanged();
}
Ejemplo n.º 6
0
void QSchedulerConfig::setDataSource(const int data_source) {
    data_source_ = data_source;

    emit dataSourceChanged();
}
Ejemplo n.º 7
0
KexiDataSourcePage::KexiDataSourcePage(QWidget *parent)
        : KexiPropertyPaneViewBase(parent)
        , m_noDataSourceAvailableSingleText(
            i18n("No data source could be assigned for this widget.") )
        , m_noDataSourceAvailableMultiText(
            i18n("No data source could be assigned for multiple widgets.") )
        , m_insideClearFormDataSourceSelection(false)
#ifdef KEXI_NO_AUTOFIELD_WIDGET
        , m_tableOrQuerySchema(0)
#endif
{
    infoLabel()->setContentsMargins(0, 0, 0, spacing());

    m_noDataSourceAvailableLabel = new QLabel(m_noDataSourceAvailableSingleText, this);
    m_noDataSourceAvailableLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
    m_noDataSourceAvailableLabel->setContentsMargins(0, 0, 0, spacing());
    m_noDataSourceAvailableLabel->setAlignment(Qt::AlignBottom | Qt::AlignLeft);
    m_noDataSourceAvailableLabel->setWordWrap(true);
    mainLayout()->addWidget(m_noDataSourceAvailableLabel);

    //-Widget's Data Source
    QHBoxLayout *hlyr = new QHBoxLayout();
    mainLayout()->addLayout(hlyr);
#if 0
//! @todo unhide this when expression work
// m_widgetDSLabel = new QLabel(i18nc("Table Field, Query Field or Expression", "Source field or expression"), this);
#else
    m_widgetDSLabel = new QLabel(
        i18nc("Table Field or Query Field", "Widget's data source"), this);
#endif
    m_widgetDSLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    m_widgetDSLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
    hlyr->addWidget(m_widgetDSLabel);

#if 0
    m_clearWidgetDSButton = new KexiSmallToolButton(
        koIcon("edit-clear-locationbar-rtl"), QString(), this);
    m_clearWidgetDSButton->setObjectName("clearWidgetDSButton");
    m_clearWidgetDSButton->setMinimumHeight(m_widgetDSLabel->minimumHeight());
    m_clearWidgetDSButton->setToolTip(i18n("Clear widget's data source"));
    hlyr->addWidget(m_clearWidgetDSButton);
    connect(m_clearWidgetDSButton, SIGNAL(clicked()),
            this, SLOT(clearWidgetDataSourceSelection()));
#endif

    m_widgetDataSourceCombo = new KexiFieldComboBox(this);
    m_widgetDataSourceCombo->setObjectName("sourceFieldCombo");
    m_widgetDataSourceCombo->setContentsMargins(0, 0, 0, 0);
    m_widgetDSLabel->setBuddy(m_widgetDataSourceCombo);
    connect(m_widgetDataSourceCombo->lineEdit(), SIGNAL(clearButtonClicked()),
        this, SLOT(clearWidgetDataSourceSelection()));
    mainLayout()->addWidget(m_widgetDataSourceCombo);
    
    m_widgetDataSourceComboSpacer = addWidgetSpacer();

    //- Form's Data Source
    hlyr = new QHBoxLayout();
    hlyr->setContentsMargins(0, 0, 0, 0);
    mainLayout()->addLayout(hlyr);
    m_dataSourceLabel = new QLabel(i18n("Form's data source"), this);
    m_dataSourceLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    m_dataSourceLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
    hlyr->addWidget(m_dataSourceLabel);

    m_gotoButton = new KexiSmallToolButton(
        koIcon("go-jump"), QString(), this);
    m_gotoButton->setObjectName("gotoButton");
    m_gotoButton->setToolTip(i18n("Go to selected form's data source"));
    m_gotoButton->setWhatsThis(i18n("Goes to selected form's data source"));
    hlyr->addWidget(m_gotoButton);
    connect(m_gotoButton, SIGNAL(clicked()), this, SLOT(slotGotoSelected()));

#if 0
    m_clearDSButton = new KexiSmallToolButton(
        koIcon("edit-clear-locationbar-rtl"), QString(), this);
    m_clearDSButton->setObjectName("clearDSButton");
    m_clearDSButton->setMinimumHeight(m_dataSourceLabel->minimumHeight());
    m_clearDSButton->setToolTip(i18n("Clear form's data source"));
    hlyr->addWidget(m_clearDSButton);
    connect(m_clearDSButton, SIGNAL(clicked()), this, SLOT(clearFormDataSourceSelection()));
#endif

    m_formDataSourceCombo = new KexiDataSourceComboBox(this);
    m_formDataSourceCombo->setObjectName("dataSourceCombo");
    m_formDataSourceCombo->setContentsMargins(0, 0, 0, 0);
    m_dataSourceLabel->setBuddy(m_formDataSourceCombo);
    connect(m_formDataSourceCombo->lineEdit(), SIGNAL(clearButtonClicked()),
        this, SLOT(clearFormDataSourceSelection()));
    mainLayout()->addWidget(m_formDataSourceCombo);

    m_formDataSourceComboSpacer = addWidgetSpacer();

#ifdef KEXI_NO_AUTOFIELD_WIDGET
    m_availableFieldsLabel = 0;
    m_addField = 0;
    mainLayout()->addStretch();
#else
    //2. Inserting fields

    //helper info
//! @todo allow to hide such helpers by adding global option
    hlyr = new QHBoxLayout();
    hlyr->setContentsMargins(0, 0, 0, 0);
    mainLayout()->addLayout(hlyr);
    m_mousePointerLabel = new QLabel(this);
    hlyr->addWidget(m_mousePointerLabel);
    m_mousePointerLabel->setPixmap(koIcon("mouse_pointer"));
    m_mousePointerLabel->setFixedWidth(m_mousePointerLabel->pixmap()
                                       ? m_mousePointerLabel->pixmap()->width() : 0);
    m_availableFieldsDescriptionLabel = new QLabel(
        i18n("Select fields from the list below and drag them onto"
             " a form or click the \"Insert\" button"), this);
    m_availableFieldsDescriptionLabel->setAlignment(Qt::AlignLeft);
    m_availableFieldsDescriptionLabel->setWordWrap(true);
    hlyr->addWidget(m_availableFieldsDescriptionLabel);

    //Available Fields
    hlyr = new QHBoxLayout();
    hlyr->setContentsMargins(0, 0, 0, 0);
    mainLayout()->addLayout(hlyr);
    m_availableFieldsLabel = new QLabel(i18n("Available fields"), this);
    m_availableFieldsLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    hlyr->addWidget(m_availableFieldsLabel);

    m_addField = new KexiSmallToolButton(
        koIcon("add_field"), i18nc("Insert selected field into form", "Insert"), this);
    m_addField->setObjectName("addFieldButton");
    m_addField->setFocusPolicy(Qt::StrongFocus);
    m_addField->setToolTip(i18n("Insert selected fields into form"));
    m_addField->setWhatsThis(i18n("Inserts selected fields into form"));
    hlyr->addWidget(m_addField);
    connect(m_addField, SIGNAL(clicked()), this, SLOT(slotInsertSelectedFields()));

    m_fieldListView = new KexiFieldListView(this,
        KexiFieldListView::ShowDataTypes | KexiFieldListView::AllowMultiSelection);
    m_fieldListView->setObjectName("fieldListView");
    m_fieldListView->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
    m_availableFieldsLabel->setBuddy(m_fieldListView);
    mainLayout()->addWidget(m_fieldListView, 1);
    connect(m_fieldListView, SIGNAL(selectionChanged()),
            this, SLOT(slotFieldListViewSelectionChanged()));
    connect(m_fieldListView,
            SIGNAL(fieldDoubleClicked(QString,QString,QString)),
            this, SLOT(slotFieldDoubleClicked(QString,QString,QString)));
#endif

    mainLayout()->addStretch(1);

    connect(m_formDataSourceCombo, SIGNAL(textChanged(QString)),
            this, SLOT(slotFormDataSourceTextChanged(QString)));
    connect(m_formDataSourceCombo, SIGNAL(dataSourceChanged()),
            this, SLOT(slotFormDataSourceChanged()));
    connect(m_widgetDataSourceCombo, SIGNAL(selected()),
            this, SLOT(slotFieldSelected()));

    clearFormDataSourceSelection();
    slotFieldListViewSelectionChanged();
}