コード例 #1
0
void TASARIM_BATCH_BASE::SLOT_RESIM_EKLE_BUTTON_CLICKED()
{
    m_design_widget->RESET_VARIABLE();

    QString file_name = QFileDialog::getOpenFileName( NULL, tr("Open Picture"), "", tr("Picture File (*.png *.jpg *.bmp)"));

    if ( file_name.isEmpty() EQ true ) {
        return;
    }

    QLabel * user_label = m_design_widget->CREATE_NEW_LABEL("");

    user_label->setPixmap(file_name);
    user_label->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored  );
    user_label->setScaledContents(true);

    TASARIM_DEGISKENI * degisken =  new TASARIM_DEGISKENI(true);

    degisken->SET_TASARIM_ID( m_tasarim_id );
    degisken->SET_TEXT( file_name );
    degisken->SET_GRUP( USER_IMG );
    degisken->SET_BELGE_DEGISKEN_ID( -1 );
    degisken->SET_FONT_SIZE( 13 );
    degisken->SET_ALIGN( 10 );
    degisken->SET_VISIBLE( true );
    degisken->SET_POS_X( 0.00 );
    degisken->SET_POS_Y( 0.00 );
    degisken->SET_SIZE_X( 30 );
    degisken->SET_SIZE_Y( 30 );
    degisken->SET_IMAGES( *user_label->pixmap() );
    degisken->SET_LABEL( user_label );
    degisken->SET_DEGISKEN_ID(-1);

    user_label->setObjectName( QString::number(degisken->GET_PRIMARY_ID() ) + "\t"+ QString::number( degisken->GET_GRUP() ) );

    m_all_variables.append( degisken );

    m_design_widget->ADD_NEW_VARIABLE(0, 0, user_label);
}
コード例 #2
0
void TASARIM_BATCH_BASE::SLOT_TEXT_EKLE_BUTTON_CLICKED()
{
    m_design_widget->RESET_VARIABLE();

    QDialog     * dialog      = new QDialog;
    QGridLayout * box_layout  = new QGridLayout;
    QLabel      * label       = new QLabel;
    QLineEdit   * line_edit   = new QLineEdit;
    QComboBox   * combobox_grup = new QComboBox;
    QPushButton * push_button = new QPushButton("Yazı Ekle");

    line_edit->setMinimumWidth(350);

    combobox_grup->addItem(tr("Add the Form "));
    combobox_grup->addItem("Add the Line");

    dialog->setLayout     (box_layout);
    box_layout->addWidget (label,         0, 0);
    box_layout->addWidget (line_edit,     0, 1);
    box_layout->addWidget (push_button,   0, 2);
    box_layout->addWidget (combobox_grup, 1, 1);

    combobox_grup->setVisible(false);

    connect( push_button, SIGNAL(clicked()), dialog, SLOT(close()));

    dialog->exec();

    if ( line_edit->text().isEmpty() EQ true ) {
        return;
    }

//    int text_grup = combobox_grup->currentIndex();

    QLabel * user_label = m_design_widget->CREATE_NEW_LABEL(line_edit->text());

    TASARIM_DEGISKENI * degisken =  new TASARIM_DEGISKENI(true);

    degisken->SET_TASARIM_ID( m_tasarim_id );
    degisken->SET_TEXT( line_edit->text() );
    degisken->SET_TEXT_SIZE( line_edit->text().size() ); // txt uzunlugu kadar
    degisken->SET_GRUP( USER_TEXT);

//    if ( text_grup EQ 0 ) {
//        degisken->SET_GRUP( USER_TEXT);
//    }
//    else {
//        degisken->SET_GRUP(LINE);
//    }
    degisken->SET_BELGE_DEGISKEN_ID( -1 );
    degisken->SET_DEGISKEN_ID(-1);

    degisken->SET_FONT_SIZE( 11 );
    if ( m_printer_type EQ DOT_MATRIX_PRINTER ) {
        degisken->SET_FONT_SIZE( 10 );
    }

    degisken->SET_ALIGN( 10 );
    degisken->SET_VISIBLE( true );
    degisken->SET_POS_X( 0.00 );
    degisken->SET_POS_Y( 0.00 );
    degisken->SET_SIZE_X( 0 );
    degisken->SET_SIZE_Y( 0 );

    degisken->SET_LABEL( user_label );

    if ( m_printer_type EQ DOT_MATRIX_PRINTER ) {
        degisken->SET_FONT_FAMILY("Monospace");
    }

    QFont font = user_label->font();
    font.setFamily(degisken->GET_FONT_FAMILY());
    user_label->setFont(font);

    user_label->setObjectName( QString::number( degisken->GET_PRIMARY_ID())+ "\t"+QString::number( degisken->GET_GRUP() ) );

    m_all_variables.append( degisken );

    m_design_widget->ADD_NEW_VARIABLE( 0, 0, user_label );

}