小编Aer*_*ate的帖子

如何禁用列表框上的突出显示但保持选择?

我无法找到如何不允许我的ListBox突出显示所选项目.我知道我没有添加触发器来突出显示该项目.

<ListBox Name="CartItems" ItemsSource="{Binding}"
         ItemTemplate="{StaticResource TicketTemplate}" 
         Grid.Row="3" Grid.ColumnSpan="9" Background="Transparent"
         BorderBrush="Transparent">
</ListBox>
Run Code Online (Sandbox Code Playgroud)

wpf xaml listbox

33
推荐指数
4
解决办法
4万
查看次数

`QObject`子类和复制构造函数出错:`QObject :: QObject(const QObject&)是private`

我有以下编译错误:

/usr/lib/qt-3.3/include/qobject.h: In copy constructor Product::Product(const Product&):
/usr/lib/qt-3.3/include/qobject.h:211: error: QObject::QObject(const QObject&) is private
Product.h:20: error: within this context
HandleTCPClient.cpp: In member function int Handler::HandleTCPClient(int, std::string, std::string):
HandleTCPClient.cpp:574: note: synthesized method Product::Product(const Product&) first required here 
HandleTCPClient.cpp:574: error:   initializing argument 1 of std::string productDetails(Product)
/usr/lib/qt-3.3/include/qobject.h: In member function Product& Product::operator=(const Product&):
Product.h:20:   instantiated from void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = Product, _Alloc = std::allocator<Product>]
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:610:   instantiated from âvoid std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = …
Run Code Online (Sandbox Code Playgroud)

c++ sockets networking qt

8
推荐指数
1
解决办法
1万
查看次数

如何将变量与文本块绑定

我想知道如何将文本块绑定到我的C#类中的变量.

基本上我的.cs文件中有一个"cart"变量.在那个Cart类中,我可以访问不同的总数.

以下是我对绑定的看法,但它似乎没有绑定到变量......

<StackPanel
   Width="Auto"
   Height="Auto"
   Grid.ColumnSpan="2"
   Grid.Row="5"
   HorizontalAlignment="Right">
   <TextBlock
      Name="Subtotal"
      FontFamily="Resources/#Charlemagne Std"
      FontSize="20"
      Text="{Binding ElementName=cart, Path=SubTotal}">
   </TextBlock>
   <TextBlock
      Name="Tax"
      FontFamily="Resources/#Charlemagne Std"
      FontSize="20"
      Text="{Binding ElementName=cart, Path=Tax}">
   </TextBlock>
   <TextBlock
      Name="Total"
      FontFamily="Resources/#Charlemagne Std"
      FontSize="20"
      Text="{Binding ElementName=cart, Path=Total}">
   </TextBlock>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)

这样做的正确方法是什么?再次感谢您的帮助!

data-binding wpf textblock

8
推荐指数
2
解决办法
3万
查看次数

PHP数组 - 试图获取非对象的属性

我还是PHP新手所以请耐心等待.

所以我收到此错误:注意:尝试在此行上获取非对象的属性:

echo (
            "<tr>".
            "<td>".$row->last_name.     "</td>".
            "<td>".$row->first_name.    "</td>".
            "<td>".$row->phone_no.      "</td>".
            "<td>".$row->date_of_birth. "</td>".
            "<td>".$row->membership.    "</td>".
            "</tr></table>");
Run Code Online (Sandbox Code Playgroud)

我在我的函数上使用了print_r,得到了:

Array
(
    [0] => Array
    (
        [0] => Lee
        [last_name] => Lee
        [1] => Lian
        [first_name] => Lian
        [2] => 39025823
        [phone_no] => 39025823
        [3] => 1967-09-19
        [date_of_birth] => 1967-09-19
        [4] => T
        [membership] => T
        [5] =>
        [status] =>
        [6] => 0
        [room_no] => 0
    )
)
Run Code Online (Sandbox Code Playgroud)

所以数组中有元素.

实际代码属于:

foreach($array as $row)
    {
            echo (
            "<tr>".
            "<td>".$row->last_name.     "</td>".
            "<td>".$row->first_name.    "</td>".
            "<td>".$row->phone_no.      "</td>". …
Run Code Online (Sandbox Code Playgroud)

html php arrays

7
推荐指数
3
解决办法
3万
查看次数

C++ - 对`vtable的未定义引用

我想知道为什么我得到这个错误:未定义引用`vtable for BaseRenderer'

我试着四处寻找,但似乎无法解决这个问题.我已经尝试摆脱虚函数,删除构造函数等.

我的BaseRenderer.h

class BaseRenderer : public Renderer
{
 Q_OBJECT

    public:
        BaseRenderer();
        BaseRenderer(QWidget *parent);
        void paintGL();

        virtual ~BaseRenderer();

 public slots:
  void loadDialog();

 signals:

    protected:
        Mesh loadMesh(string fileName);

    private:

        OBJParser objParser;
        Mesh baseTerrain;

};
Run Code Online (Sandbox Code Playgroud)

我的BaseRenderer.cpp

BaseRenderer::BaseRenderer()              <------ Error leads me here
{
}

BaseRenderer::BaseRenderer(QWidget *parent) : Renderer(parent)
{

}

BaseRenderer::~BaseRenderer()
{
    //dtor
}
Run Code Online (Sandbox Code Playgroud)

我该如何摆脱这个问题呢?我也听说可能是编译器......?谢谢您的帮助 :)

c++ qt

6
推荐指数
1
解决办法
5107
查看次数

AJAX - 将数据发送到我的php文件似乎不起作用

我还是JQuery,AJAX和PHP的新手.

我想知道我在这里做错了什么.我正在接收有关客户的信息并尝试在同一页面上返回确认消息.

所以我遇到的问题:1)点击提交按钮刷新我的页面?为什么?

2)我的提交按钮下方.如何使用addCustomer.php的结果更改其文本?

3)将我的javascript和php代码放在customer.php下的同一个文件中是否可以?

编辑:我也使用Firefox的防篡改数据插件 - 当我点击提交时,由于某种原因没有发送数据.

Customer.php

<script type="text/javascript">

$(document).ready(function(){
    $('#submit').click(function() {
        $.ajax({
            type : 'POST',
            url : 'addCustomer.php',
            dataType : 'json',
            data:{
                add_LN : $('#add_LN').val(),
                add_FN : $('#add_FN').val(),
                add_PN : $('#add_PN').val(),
                add_DOB : $('#add_DOB').val()
            },
            success : function(data){
                //I want to change the "confirmMsg" to the string given back from addCustomer.php
            }
        }
    }
}

</script>

<p>&nbsp;</p>
<p>Add New Customer:</p>
<div align="center">
<form>
  <table width="396" border="1">
    <tr>
      <td width="133"><p>Last Name:</p>
      <p>First Name:</p>
      <p>Phone Number:</p>
      <p>Date of Birth:</p></td> …
Run Code Online (Sandbox Code Playgroud)

html javascript php ajax jquery

6
推荐指数
1
解决办法
1903
查看次数

替换文本文件中一行的值

我目前正在编辑文本文件的一行。当我尝试覆盖文本文件时,我只在文本文件中恢复一行。我正在尝试调用该函数

modifyconfig "test" "100"
Run Code Online (Sandbox Code Playgroud)

config.txt:

检查=0
测试=1

modifyConfig()功能:

Function modifyConfig ([string]$key, [int]$value){
    $path = "D:\RenameScript\config.txt"

    ((Get-Content $path) | ForEach-Object {
        Write-Host $_
        # If '=' is found, check key
        if ($_.Contains("=")){
            # If key matches, replace old value with new value and break out of loop
            $pos = $_.IndexOf("=")
            $checkKey = $_.Substring(0, $pos)
            if ($checkKey -eq $key){
                $oldValue = $_.Substring($pos+1)
                Write-Host 'Key: ' $checkKey
                Write-Host 'Old Value: ' $oldValue
                $_.replace($oldValue,$value)
                Write-Host "Result:" $_
            }
        } else {
            # …
Run Code Online (Sandbox Code Playgroud)

string powershell replace text-files

4
推荐指数
1
解决办法
1万
查看次数

Qt,如何设置文本编辑滚动条到底部?C++

我有文本编辑框作为聊天窗口,但我想知道是否有办法将滚动条设置在底部以显示最新消息.

我目前正在使用Qt3和C++.

chat_box - > ....我试过看,只能找到"ScrollBarMode",但它只允许我打开或关闭它或自动...这实际上没有帮助.

谢谢你的帮助:D

c++ qt qt3

2
推荐指数
1
解决办法
8244
查看次数

什么是解析ajax成功函数接收的数据的更清洁/更好的方法?

我正在使用ajax函数来接收数据.根据该数据,如果找不到结果,我会收到一个字符串"找不到匹配项",并带有一些html格式.如果有结果,则将数据格式化为表格,并隐藏此部分下方的"Div"部分.

现在我遇到的问题是,当我找不到结果时,我不希望这个"Div"表消失.但是为了检查是否没有结果,我将不得不比较searchCustomer.php收到的整个字符串(这是非常大的).

有更简单的方法吗?

我的ajax电话:

$('#search').click(function(e){
        $.ajax({
            type : 'GET',
            url : 'searchCustomer.php',
            dataType :'html',
            data:{
                lastName : $('#search_LN').val(),
                firstName : $('#search_FN').val(),
                phone : $('#search_PN').val()
            },
            success : function(data){
                if (data.error == true){
                    alert("there was an error in the post layer");
                } else {
                    $('#searchResults').html(data);



                if (data.text == '<br><font color='red'>No matches found</font>'){
                }else{
                var ele = document.getElementById("NewCustomerDiv");
                ele.style.display = "none";
                }
            }
        }
    });
    return false;
});
Run Code Online (Sandbox Code Playgroud)

运行fire-bug,从searchCustomer.php收到的实际数据是:

<style type="text/css">
a.resultBookButton {
    color: black;
    padding: 1px;
    border: 2px outset lightgrey;

    background: …
Run Code Online (Sandbox Code Playgroud)

html javascript php jquery

2
推荐指数
1
解决办法
293
查看次数

我是线程的新手,这个编译错误意味着什么?

使用C++.

pthread_t threads[STORAGE]; // 0-99

...

void run()

Error>>>    int status = pthread_create(&threads[0], NULL, updateMessages, (void *) NULL);
if (status != 0)
{
    printf("pthread_create returned error code %d\n", status);
    exit(-1);
}
Run Code Online (Sandbox Code Playgroud)

...

void ClientHandler::updateMessages(void *)
{
    string reqUpdate = "91"; // Request for update
    string recvMSG;
    while (true)
    {
        sleep(5);
        sending(sock,reqUpdate); // send
        recvMSG = receiving(sock); // receive
        QString output(recvMSG);
        emit signal_chat(output, 0);    // Print message to text box
    }
}
Run Code Online (Sandbox Code Playgroud)

...

编译错误: TCPClient.cpp:109: error: argument of type ‘void (ClientHandler::)(void*)’ …

c++ multithreading

1
推荐指数
2
解决办法
499
查看次数

在QT Creator中更改按钮的颜色

如何更改按钮颜色?我已经找到了写作的方法

button->setStyleSheet("* { background-color: rgb(255,125,100) }");
Run Code Online (Sandbox Code Playgroud)

在Ui_Window.h中

但每当我qmake,Ui_Window.h重新制作,我失去了我的颜色.

有谁知道如何永久保持按钮的颜色?我正在使用QT Creator.如果有人可以指示我= D.

非常感谢!

c++ qt button stylesheet qt-creator

1
推荐指数
1
解决办法
2万
查看次数

Send和Recv的问题

所以我是套接字编程的新手.在过去的一天里,我一直试图找出我的"取消注册"问题.

到目前为止,我可以注册一个用户.但是当我取消注册时,只发送一个字节.我不知道如何解决这个问题:

抱歉我的编码不好.向下滚动到client.cpp,这是我取消注册的recv只接收1个字节=(

============================== Peer.h

#ifndef PEER_H
#define PEER_H

#include <string>
#include <iostream>
#include <arpa/inet.h>   // for sockaddr_in and inet_addr()

using namespace std;

class Peer
{
public:
    string IP;          // IP address
    int port;           // port number
    int sock;           // socket descriptor
    string name;

    /* Create a new peer entry on the server 
     * @param addr The IP and port of the peer.
     * @param desc The socket associated for the connection to the peer.
     */
    Peer(sockaddr_in addr, int desc); …
Run Code Online (Sandbox Code Playgroud)

c++ sockets

0
推荐指数
1
解决办法
722
查看次数

关于指针和对象的问题

我的最后一个问题是一团糟.我收到了错误的输出.

所以在这里我有我的主要内容:

image = QImage(width, height, 32); // 32 Bit
Color amb(0.1,0.1,0.1);
Color difCoef(0.75,0.6,0.22);
Color spec(0.5,0.5,0.5);
double shineExp = 3.0;
Sphere *s = new Sphere(Point(0.0,0.0,-5), 100.0, amb, difCoef, spec, shineExp);
shapes.push_back(s);
Run Code Online (Sandbox Code Playgroud)

其中shape是vector <Shape*>形状;

Shape *x = shapes[0];
cout << "Shine" << x->shine << endl;
Run Code Online (Sandbox Code Playgroud)

即使答案应为3.0,也打印出零.

以下是我的课程:

#include "shape.h"
class Sphere : public Shape
{
    public:
    Point centerPt;
    double radius;
    Color ambient;
    Color dif;
    Color spec;
    double shine;

    Sphere(Point center, double rad, Color amb, Color difCoef, Color specu, double shineVal)
    { …
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
153
查看次数